Make a basic addition problem help

How to make a basic addition problem. I want the program to say enter a number 10 times. Like this
enter a number..(x10)
repeating that 10 times then the final result is all of them added together. I always thought of something like this just never seen it done before this is what I attempted its says what I want but it doesn't add them.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <string>
#include <iostream>
#include <vector>

using namespace std;


int main()

{
    int number = 0;
    int sum;
    for(number = 0; number < 100; number++)

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





    }
}

Do not use number twice: as the loop index and for input.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <string>
#include <iostream>
#include <vector>

using namespace std;


int main()

{
    int sum = 0;
    for(int i = 0; i < 100; i++)
    {
        cout << "Enter a number..(" << i << "/" << 100 << ")" << endl;
    int number;
   cin >> number;
   sum += number;




    }
// Add output for sum
}


Last edited on
Topic archived. No new replies allowed.