I've fixed most of the code now and cannot figure out how to loop my if statement if anyone could point me in where I should be looking.
int main() { //declare variables string sentence, word, acronym; string::size_type location; ifstream myIn;
myIn.open("../Acronym.dat"); //open file
assert(myIn); //check if file can be opened
//find white space & capitalize next word
while (getline(myIn,sentence))
{
acronym = sentence.substr(0,1); //bring out first letter
location =sentence.find(" ");
//while
{
if (location == (sentence.find(" "))) //capitalize word
{
sentence[location+1]=toupper(sentence[location+1]);
acronym+= sentence[location+1];
location = sentence.find(" ");
cout << acronym << endl;
}
}
}
myIn.close();
return 0;
}