•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,760 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 2810 | Replies: 7
![]() |
•
•
Join Date: Dec 2007
Posts: 5
Reputation:
Rep Power: 0
Solved Threads: 0
please help me how to get the highest and lowest number when I input 10 numbers..
the first run is:
Enter First Number:
Enter Second Number:
Enter Third Number:
Enter Fourth Number:
Enter Fifth Number:
Enter Sixth Number:
Enter Seventh Number:
Enter Eighth Number:
Enter Ninth Number:
Enter Tenth Number:
Upon Finishing Input of 10 Numbers this is the output:
The Highest Number is: (highest number)
The Lowest Number is: (lowest number)
help me code this help will be appreciated.. thanks.. help me pls.. ^_^
the first run is:
Enter First Number:
Enter Second Number:
Enter Third Number:
Enter Fourth Number:
Enter Fifth Number:
Enter Sixth Number:
Enter Seventh Number:
Enter Eighth Number:
Enter Ninth Number:
Enter Tenth Number:
Upon Finishing Input of 10 Numbers this is the output:
The Highest Number is: (highest number)
The Lowest Number is: (lowest number)
help me code this help will be appreciated.. thanks.. help me pls.. ^_^
•
•
Join Date: Mar 2005
Location: Phnom Penh, Cambodia
Posts: 415
Reputation:
Rep Power: 5
Solved Threads: 36
Maybe this will give you an idea:
http://www.daniweb.com/forums/showth...min+max+number
http://www.daniweb.com/forums/showth...min+max+number
I shot the sheriff....but I didn't shoot the deputy
•
•
Join Date: Mar 2005
Location: Phnom Penh, Cambodia
Posts: 415
Reputation:
Rep Power: 5
Solved Threads: 36
•
•
•
•
what you could do is save each number into a file, then read that file line by line into a bubble sorter. Then when the program is done the first value in the file would be your highest number and the last number would be your lowest number.
Why would you need to write it into file, when you can solve that problem without using saving into file.
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Behind every smile is a tear.
Visal .In
•
•
Join Date: Mar 2005
Location: Phnom Penh, Cambodia
Posts: 415
Reputation:
Rep Power: 5
Solved Threads: 36
•
•
•
•
i guess all you need is to place each input in an array and then do a bubble sort on that array, then output the first and last values.
Why don't you just compare it while you are inputting? Like this:
cplusplus Syntax (Toggle Plain Text)
unsigned int n, min = 65535, max = 0, x; // How many number do you want to input? scanf("%d", &n); for(int i = 0; i < n) { // Ask user to input their number printf("Please input your number: "); scanf("%d", &x); if (min > x) min = x; if (max < x) max = x; } // Out the final result printf("Max:%d\nMin:%d", max, min);
Last edited by invisal : Dec 5th, 2007 at 3:55 pm.
Yesterday is a history, tomorrow is a mystery, today is a gift.
Behind every smile is a tear.
Visal .In
Behind every smile is a tear.
Visal .In
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Genetic Algorithm (C++)
- finding the maximum and minimum (C++)
- Please help me find what small errors i have!! (C++)
- calculating sum, average, highest and lowest grades (Visual Basic 4 / 5 / 6)
- help with sorting arrays from hightest to lowest (C++)
- Random number with ascending order help (C++)
- min and max values (C++)
- Help with classes (C++)
Other Threads in the C++ Forum
- Previous Thread: New to try/catch
- Next Thread: help!



Linear Mode