Suppose I have an input file:

after each line I want to print the sum of all integers in the line? how to do that?Code:`34, 53, 45, 87, 76, 39`

24, 78, 54, 98

.....

Printable View

- 08-18-2010kapil1089thekinprocessing input file
Suppose I have an input file:

Code:`34, 53, 45, 87, 76, 39`

24, 78, 54, 98

.....

- 08-18-2010Salem
Read a whole line using getline()

Parse the line, looking for numbers and commas.

The parsing could be done any number of ways.

First you should decide whether to use a char array or a std::string.

If you at least try something, we can push you along when you get stuck.