Sorry for the late reply.
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int i;
int num;
int icount;
int sum = 0;
cout << "How many numbers would you like to add? ";
cin >> icount;
cout << "Enter " << icount << " numbers:" << endl;
for(i = 0;i < icount; i++)
{
cin >> num;
sum += num;
}
cout << "Total: " << sum;
cin.ignore();
cin.get();
}
There; the user tells the program how many inputs he would like, and the program takes that many.
You could also load all the inputs to an array if for some reason you need to easily:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int i;
int *num;
int icount;
int sum = 0;
cout << "How many numbers would you like to add? ";
cin >> icount;
num = new int[icount];
cout << "Enter " << icount << " numbers:" << endl;
for(i = 0;i < icount; i++)
{
cin >> num[i];
sum += num[i];
}
cout << "Total: " << sum;
cin.ignore();
cin.get();
}
You can do whatever you want with that array then.