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 .....
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 .....
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.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.