Maybe something along the line of:
Code:
char replace[] = {'x', 'y', 'z'};
int i, pos;
string sen;
cout << "Please enter a sentence ";
getline (cin, sen);
for (i = 0; i < sizeof(replace); i++)
{
while ((pos = sen.find(replace[i])) != string::npos)
{
sen[pos] = toupper(sen[pos]);
}
}
cout << sen;
replace is a character array that contains all the characters you want to capitalize. I first iterate over all the characters inside that array, to have them all treated. Then I replace the characters as long as I found one (sen.find returns string::npos if it couldn't find any occurence).