13 if(word.at(i)=='y')// changed the [] to ()
What the program does is, it loops through the entire string word and checks if the letter 'y' is present or not.
Consequently you could also have an else to have continuation in the code...something like this.
else
{
cout << "Your word, " << word << " doesn't contain " << word.at(i) << endl;
}
regards,
Raghav
This post has been edited by raghav.naganathan: 13 February 2013 - 08:54 PM

New Topic/Question
Reply




MultiQuote


|