#include <iostream> #include <iomanip> using namespace std; int main() { const int MAXSIZE = 5; //Array maximum size int pos_num[MAXSIZE]; //Array to store positive numbers int num, //Array subscript sum = 0; //Sum of the array numbers double pos_avg; //Average of numbers in the array cout << setprecision(2) << setiosflags(ios::fixed) << setiosflags(ios::showpoint); cout << endl; cout <<"Please input up to " << MAXSIZE << " positive numbers, use 0 to indicate that you are done." << endl << endl; for (num = 0; num < MAXSIZE; ++num) { cout << endl << endl; cout << "Please input postive number " << num + 1 << ": "; cin >> pos_num[MAXSIZE]; } for (num = 0; num < MAXSIZE; ++num) sum += pos_num[MAXSIZE]; pos_avg = double(sum) / MAXSIZE; cout << endl << endl; cout << "There are " << num << " postive numbers in the array. "; cout << "The average of the numbers in the array is " << pos_avg << endl; //system("pause"); return 0;

Thanks for whatever help you guys give me.