is how the input should be like. I have already made the following code that gives me a correct first name. My question is there any other efficient way I can extract the first name out of my file. Just looking for other ideas so I can have more tools and thoughts for my other assignment. Thanks for reading guys!
1 2 3 4 5 6 7 8 9 10 11 12 13
string firstname(string name)
{
//find the length of name
int length=name.length();
string::size_type pos;
pos=name.find(',');[output][/output]
// extract the first name
return name.substr(pos+1, (name.find_last_of(' ')-(pos+1)));
}