How do I save the input form the user into an array?
Here is my assignment:
create a program that reads in 5 numbers, find their sum and then print them in reverse. Use array as a tool in your program.
Here is what I have so far:
#include <iostream>
#include <stdlib.h>
using namespace std;
// This program reads in five numbers, find their sum, then prints the numbers in reverse.//
int main ()
{
const int numlist = 2;
int num[ numlist];
int total ;
int numcount;
for (numcount = 0; numcount < 2; numcount ++)
{
cout << " Enter five numbers: " << endl;
cin >> num[2];
cout << num[2];
}
for ( int i =0; i< numlist; i++)
total = num[i];
cout << "\nThe total of the numbers are: " <<total << endl;
return 0;
}