Vectors/Arrays adding sum

Program needs to accept a positive integers greater than or equal to one,then store values into elements of an array/vector all while executing.
then add up the total of all the values within the elements and display.

#include <iostream>
using namespace std;
int i;

int main()
{
int n;
cout << "enter positive integer: ";
cin >> n;
if (n<1)
{cout <<"invalid input"<<endl;}
while (n >= 1)
{
for (i=1;i<=n;i++)
return 0;
}}
Hi Pomptree,

well I don't think you need the for loop, but lets get you started here in the right track.

Please read
http://www.cplusplus.com/articles/jEywvCM9/

and then format your code with code tags.

Thx
Topic archived. No new replies allowed.