I have a vector defined like this:
#include<iostream>
#include<vector>
using namespace std;
typedef vector<int> VECTORINT;
int main() {
VECTORINT Vectorul;
int x;
int num;
int y;
cin>>num; //the number of numbers that must be entered
for(int i = 0; i<num; i++){cin>>x;
Vectorul.push_back(x);
for(int i=0; i<Vectorul.size(); i++)
cout<<Vectorul[i]<<endl;
}
system("pause");
return 0;
}
After I get the input numbers I want to add them to one each other ex:
I get the numbers 1,2,3 and after I want to add the 1+2+3.
Anyone has any idea how to do this?