Paradox1
Fully Optimized
- Messages
- 2,913
You need to
Ok. I have to write a code that finds the Largest and smallest integer entered. I do this by checking if the number is greaterthan or less than the other numbers that were entered.. But you theres nothing to compare it to if it keeps changing everytime it loops, I need to make input = something different each time it loops or something then compare the results afterwards but you cant change it during the loop either...
This is pissing me off because if i wasnt so tired id be able to do this in 2 seconds, but im like having a brainfart or something. Like those times when theres a name, or a word or something and its like right at the tip of your tongue you just cant quite get it, only worse
This is what I have so far:
(Project Requirements:
Display number of integers entered
The average of all the integers
Largest integer entered
Smallest integer entered
Difference between largest and smallest integers)
Ever if you dont get the code part you should be able to get the how to figure out largest and smallest integers (hopefully)
Ok. I have to write a code that finds the Largest and smallest integer entered. I do this by checking if the number is greaterthan or less than the other numbers that were entered.. But you theres nothing to compare it to if it keeps changing everytime it loops, I need to make input = something different each time it loops or something then compare the results afterwards but you cant change it during the loop either...
This is pissing me off because if i wasnt so tired id be able to do this in 2 seconds, but im like having a brainfart or something. Like those times when theres a name, or a word or something and its like right at the tip of your tongue you just cant quite get it, only worse
This is what I have so far:
Code:
#include <iostream.h>
int input, totalint, average, largest, smallest, difls, sum, devideby;
int main()
{
cout << "Please enter in your integers one at a time. \n(Type 0 to quit)\n";
do {
cin >> input;
totalint = totalint++;
sum = sum + input;
//If statement goes here
} while (input !=0);
devideby = totalint - 1;
average = sum / devideby;
cout << "Number of Integers entered: " << totalint - 1<< endl;
cout << "Average of Combined Integers: " << average << endl;
cout << "Largest Integer Entered: " << largest << endl;
cout << "Smallest Integer Entered: " << smallest << endl;
cout << "Difference Between Largest and Smallest integers: " << difls << endl;
cout << "Sum of Combined Integers: " << sum << endl;
return 0;
}
(Project Requirements:
Display number of integers entered
The average of all the integers
Largest integer entered
Smallest integer entered
Difference between largest and smallest integers)
Ever if you dont get the code part you should be able to get the how to figure out largest and smallest integers (hopefully)