For my homework assignment, we were asked to:

Prompt the user for a positive number and get it from the user. Print each integer from 1 up to and including the user's number and the sum of all the integers from 1 up to and including each integer. Your output should start like this:

1     1
2     3
3     6
4    10
5    15
6    21    etc.

I can't get a running average on every line. My code looks like this:

int main()
    int number;
    int sum;
    int x;


    cout << "Enter a positive number." << endl;
    cin >> number;

       sum = sum + x;
    cout << x << "      " << sum << endl;



    return 0;

Right now, all I can get it to do is add 1 to the input number and put the average of all numbers up to that next to it. Can anyone help?