While I can
barely bear your bareness, I refuse to be bare with you
just have to grin and bear it.
I guess I could bare a bear if you supply the clippers... but let us take arms against this sea of berings and, by opposing, end them!
I simply want to read a file "data.txt" line by line
Then char by char and add them into a result var.
The file is supossed to always contain numeric values
The secret with homework is that they are exercises about a lesson just gone. The answer is in your friends notes - just not in so many words. So your first step is to reword the task so it reads more generically - thus:
you want to sum the numbers in a data file. In the first instance, the numbers are seperated by newline characters and in the second they are all single digit numbers, and you don't care about other the newlines.
This is an exercise in converting between string and numerical data as well as reading from a file.
Have a look at other examples:
... yours is just like that only the formatting is different. Show it to your freind and try help him figure it out.
When you are helping someone with their homework, it is best to let them do the actual discovery - you can help best by guiding them through the search process.