Can anybody help me? In the code i have instead of erasing the punctuation as shown, i need to strip it out to be re-used later on when the word that precedes it has been expanded from its abbreviated form. Any help would be greatly appreciated. N.B This is only one function of the code, to display the vectors and open the infile etc... have been placed in separate functions.
void readText2(ifstream &infile, vector <string> &textFile2 )
{
while( !infile.eof() )
{
string fileWord;
infile >> fileWord;
for (size_t i=0; i !=fileWord.length(); i++)
{
fileWord[i]=toupper(fileWord[i]);
}
for (size_t i=0; i < fileWord.length(); i++)
{
if (ispunct (fileWord[i]))
{
fileWord.erase(i);
}
}
textFile2.push_back(fileWord);
}
infile.close();
}