I have just started to program an I am stuck in one problem. So I have a txt file that contains a single line: i.e. 13digitnumber 13digitnumber letter randomstring letter(could be same) The question is I need to find the letter of which there could be from 3 different choices and print. I have decided to have seperate function for this. so far I have done:
The question is I need to find the letter of which there could be from 3 different choices and print
Your code snippet doesn't match the description, it is searching for randomstring not a letter
Lets say your file contains
1234567890123 1234567890123 A ABCDEFG V
A very crude way to read the file into different parts.
1 2 3 4 5 6
ifstream src("data.txt"); // please add error checking
string dummy, name1, msg, name2;
while (src >> dummy >> dummy >> name1 >> msg >> name2)
{
// now check it name1 or name2 contains the wanted name or letter
}