![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
without doing bubble sort how to find the minimum number?Hi there
assume there an "int" array called numbers: int numbers[5] = {23, 45, 3, 22, 12}; In this case since we can see the array elements it's obviouse that which is the lowest. But assume we dont see those elements. Then Without doing a bubble sort how do i find the lowest in those elements? PS: I need to do this WITHOUT using pointers. |
|||
|
#2
|
|||
|
|||
Re: without doing bubble sort how to find the minimum number?#include <limits.h>
int min; int i; min = INT_MAX; for (i = 0; i < 5; i++) if (numbers[i] < min) min = numbers[i]; |
|
#3
|
|||
|
|||
Re: without doing bubble sort how to find the minimum number?Quote:
CPP / C++ / C Code:
CPP / C++ / C Code:
Unfortunately, baccardi gave you a direct answer so you could not learn from this assignment. Although I would change parts of that example it will probably do what you need. |
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to sort in C++ alphabetically | wilen | C++ Forum | 5 | 20-Apr-2007 14:43 |
| Converting a number amount to text | Godzilla | C++ Forum | 5 | 31-Mar-2006 11:38 |
| Anyone can write a program code for this??? | chriskan76 | C Programming Language | 1 | 19-Oct-2004 20:25 |
| Apache2 config issues | monev | Apache Web Server Forum | 2 | 28-Jun-2004 06:19 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The