#include <iostream>
using namespace std;
int main()
{
//Variables
int number = 0;
int min, max;
//Comments
cout << "This program will let you enter number after" <<endl;
cout << "number. Enter 99 when you want to quit the " <<endl;
//For initialising values of min and max
cin>>number;
if(number==99) return(0); //if the number is 99 the program will quit
min = max = number; //initialize the values of min and max to compare with later inputs
//Loop to get the numbers
while(number!=99) //loop
{
cin>>number;
//Evaluating the numbers
if(number ==99) break; //break the loop or else max will become 99 if this line is not there
else if(number>max) max = number; //if the no. is greater than max then it becomes the max
else if(number<min) min = number; // if the no. is smaller than min then it becomes min
} //end of loop
//Printing the smallest and biggest numbers
cout<<"The smallest number is: "<<min<<endl; //displays smallest no.
cout<<"The biggest number is: "<<max<<endl; //displays biggest no.
*
*system("PAUSE");
*return 0;
}
Also works for me.
Thanks guys.
__________________
Personal Portfolio
TecBrain Support Forum
Linux VS Windows ... Dont Even Think of it ..
Distribution: Slackware
if (OS==Linux) return success
There are 10 kinds of people, those who can read binary numbers and those who can't.