okay so enclosed is the program i am working on for class, basically what it does is it will take the provided integers and get the avg of them as well as the difference, smallest and largest number; but my problem is that i need it to be where if the user enters a "0" then the program will go to the end and basically still show the avg of the numbers up till 0, the smallest, largest and difference as well, so if someone could please help/ teach me to do this it would be mostly appreciated. by the way i hope i posted this properly i am just getting used to writing codes.
--------------------------------------------------------------
--------------------------------------Code://Charles Shane Miller Jr. #include <cstdlib> #include <iostream> using namespace std; int main() { int one; // integer uno int two; // integer dos int three; // integer tres int four; // integer cuatro int five; // integer cinco int avg; // average int smallest; int largest; int diff; int zero; cout << "So what is lucky number one?" << endl; cin >> one; cout << "okay and what shall the terrible second integer be?" << endl; cin >> two; cout << "So what is unlucky number 3?" << endl; cin >> three; cout << "okay and que es numero cuatro por favor?" << endl; cin >> four; cout << "and last but not least, what is lucky number five? " << endl; cin >> five; avg = one * two * three * four * five / 5 ; //formula to take integers and get the average cout << "" << endl; cout <<"The average of the numbers is " << avg << endl; // outputs the answer in a user friendly way cout << "" << endl; if ( one < two ) // start of algorithm to find smallest number smallest = one; else smallest = two; if ( smallest < three ) smallest = smallest; else smallest = three; if ( smallest < four ) smallest = smallest; else smallest = four; if ( smallest < five ) smallest = smallest; else smallest = five; cout << "the smallest is " << smallest << endl; // end of algorithm to find smallest number cout << "" << endl; if ( one > two ) // start of algorithm to find largest number largest = one; else largest = two; if ( largest > three ) largest = largest; else largest = three; if ( largest > four ) largest = largest; else largest = four; if ( largest > five ) largest = largest; else largest = five; if ( 0 ) break; else { continue; } cout << "the largest is " << largest << endl; cout << " " << endl; diff = largest - smallest; cout << "The difference of the laregst number and the smallest number is " << diff << endl; system("PAUSE"); while (zero != 0); return 0; }