It is my final assignment, but i dont know how to do....can someone help me?
Write a program that reads integers, and finds the smallest and the largest. The input ends with number 0. Suppose that you entered 3 5 2 7 -1 5 0; the program finds that the smallest is -1 and largest is 7. You have to create functions smallestNumber and largestNumber, and store the entered numbers in an array.
Sample 1:
Enter an int value, the program exits if the input is 0:: 3 5 2 7 -1 5 0
User entered: 3 5 2 7 -1 5
The smallest number is -1
The largest number is 7
Sample 2:
Enter an int value, the program exits if the input is 0: 0
There is no list of numbers.
Ah, I see! Thank-you @Furry Guy! I completely misread that question.
But now I'm lost as to why exactly one has to store the numbers in an array, given that you just have to find the smallest and the largest and do nothing else with them.