Not sure if this is the right place to ask a question since I've been looking for an answer on the internet but couldn't find I thought that I might ask here. So I have a problem. I have a text file example :
R 10
G 15
Z 13
R 5
R 6
_for every line beginning with 'R', read line to a string variable.
_extract the number to convert it to an int
_create a count int and increment it with the values you converted from the strings beginning with the char R
Because the input file has a space between the letter and the number you could do something like: while (inFile >> letter >> number);. In the while loop check if "letter" matches what you want and do a += to a total. After the while you can print out something with total.