The program is suppose to check for and fix capitalization. If the program comes across a number in the name or a letter in the numbers its suppose to output it blank ,Jones rather then Fr3d,Jones. The problem I'm having is making that actually work with what I set up originally. I getline one of the lines and store it into a character array then loop through it fixing the caps and inserting a whitespace if comes across a number in the name section and inserting an x if it comes across a letter in the number section. But from here I'm lost as to how to output, I would appreciate the help.
Try using string, they come with many built-in functions! Also, the ctype.h header has a function called isdigit which returns true or false if its a numeric digit!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Char charFromFile;
string sentence;
//while char can be read from file, test if number, if it is, insert white space, if not, add it to our string!
while ( file >> charFromFile )
{
if ( isdigit(charFromFile)
{
sentence += " ";
}
else
{
sentence += charFromFile;
}
}
As for outputting it to a file, I would suggest creating a string vector to store each new line read from file and formatted correctly, which will make it much simpler to output. To output, cycle through the vector, and after each element, end the line!