I've opened a pre-existing file and am sending the data into a new file while trying to format it.
I'm trying to
- Make the first letter after the number uppercase
- create a new line when each number appears
- remove any extra spaces other than 1 right after the numbers.
If I don't include the break; I can't get out of the if-else statements so I know my logic is off somewhere. I'm not entirely sure where i'm getting hung up.
//input and output files have successfully opened
char next;
dirty_file.get(next);
clean_file << static_cast<char>(tolower(next));
while(!dirty_file.eof())
{
    if(isdigit(next))
    {
        clean_file << "\n" <<  " ";
        clean_file.put(toupper(next));
    }
    else
    {
        if(isalpha(next))
        {
            clean_file.put(toupper(next));
        }
        else if(isspace(next))
        {
            dirty_file.putback(next);
        }
        else
        {
            clean_file.put(next);
        }
        break;
    }
    dirty_file.get(next);
}
return;
 
    