I have a problem. I need to print the string called "last" in uppercase format. can you check why my program prints nothing.
here is the important section of the code.
if (infile.is_open()) // if file was able to open
while (getline(infile, line))
string::size_type pos1 = line.find(' '); //pos1 is the position of the first space
if (pos1 != string::npos)
string::size_type pos2 = line.find(',', pos1); //pos2 is the position of the comma
string last = line.substr(pos1, pos2 - pos1); //remove everything before the first space