read numbers from txt.file

I have some rows with numbers.

For example:
3
3 23
2 45
4 15

the first number is the number of the line.
i want to add the numbers on the right.and the first number can be any number from 5 till 100000000......
and i open the numbers from the txt file with a loop.

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
27
28
29
30
31
32
33
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <sstream>
#include <stdio.h>
#include <time.h>

using namespace std;

int main()
{
    int a,b,i,c;
    string line;
    
    ifstream f;
    f.open("data.txt");
    if(f.is_open());
    {
    getline (f,line);
    istringstream (line)>>a;
    
    for(i=1;i<=a;i++)
    {
    f>>b>>c;
    
}

}
system ("PAUSE");
return 0;
}


Thats my code so far!
And i want to add all the first numbers.
3+2+4. How can i do that?????
This numbers are in a text file....
Topic archived. No new replies allowed.