### Help with programing project.

I am required to make a program which asks the user for a series of values one at a time. When the User enters the integer 0, the program displays the following information:
-The number of integers in the series, not including 0.
-The average of the integers.
-The largest integer and the smallest integer in the series.
-The difference between the largest and smallest integers.

At the moment, I cannot post what I have so far, as is is on a different computer and I don't have a drive. I would greatly appreciate any help available. I will try to post what I have so far ASAP. Thank You.
Hey I'm fairly new to c++ so my code may not be the most efficient but here's something to go off of. Hope it helps!
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374`` ``````#include using namespace std; double findaverage(int intarray[],int arraysize) { int total = 0; for (int x = 0; x < (arraysize - 1); x++) { total += intarray[x]; } return ((double)total/(arraysize - 1)); } int findsmallest(int intarray[],int arraysize) { int smallest = intarray[0]; for (int x = 1; x < (arraysize - 1); x++) { if (intarray[x] < intarray[x-1]) { smallest = intarray[x]; } } return smallest; } int findlargest(int intarray[],int arraysize) { int largest = intarray[0]; for (int x = 1; x < (arraysize - 1); x++) { if (intarray[x] > intarray[x-1]) { largest = intarray[x]; } } return largest; } void pause(void) { cout << "Press any key to exit"; cin.ignore(); cin.get(); } int main (void) { int user_input = 1; int arraysize = 0; int intarray[500]; do { cout << "Please input a number, 0 to stop (500 max numbers)" << endl; cin >> user_input; intarray[arraysize] = user_input; arraysize++; } while (user_input != 0); cout << "The number of ints entered is " << (arraysize - 1) << endl; cout << "The average is " << findaverage(intarray,arraysize) << endl; cout << "The smallest is " << findsmallest(intarray,arraysize) << endl; cout << "The largest is " << findlargest(intarray,arraysize) << endl; cout << "The difference between the largest and smallest integers is " << (findlargest(intarray,arraysize) - findsmallest(intarray,arraysize)) << endl; pause(); return 0; } ``````
I'll try it, thanks so much!
Topic archived. No new replies allowed.