### Help with setting the maximum and minimum numbers in a series

Okay, so, I need to write a program that not only calculates the minimum and maximum, but also calculates the average and the difference between the largest and the smallest.

Here's the code:
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162`` ``````#include #include #inlcude #include using namespace std; int main() { int n; long num1, num2, num3, num4, num5, num6, num7, num8, num9, average, difference, min, max; do { cout << "Enter a maximum of 9 integers (enter 0 to quit at any point):" << endl; min = 0; max = 0; if (cin == 0) {break;} for (n = 0; n <= 9;) cin >> num1; n = n++; cin >> num2; n = n++; cin >> num3; n = n++; cin >> num4; n = n++; cin >> num5; n = n++; cin >> num6; n = n++; cin >> num7; n = n++; cin >> num8; n = n++; cin >> num9; n = n++; break; } while(1); average = (num1 + num2 + num3 + num4 + num5 + num6 + num7 + num8 + num9) / n; while (cin != 0) { if (std::cin >= max) { max = cin; } else if (std::cin =< min) { min = cin; } } difference = max - min; cout << "Alright let's hope this works." << endl; cout << "Numer of integers entered: " << n << endl; cout << "Average of the integers entered: " << average << endl; cout << "Largest integer: " << max << endl; cout << "Smallest number: " << min << endl; cout << "And the range of the integers: " << difference << endl; Sleep(2000); cout << "Did it work?" << endl; Sleep(1000); cout << "If not I will punch something"; Sleep(1000); cout << "Oh well, see ya!"; Sleep(2000); return 0; }``````

I know the problem is the "sdt::cin" but I don't know what else to do, any help please?
take the "std::" out
Topic archived. No new replies allowed.