How do you exit a sentinel controlled loop forcefully ?
while (finalstar != word && ct1 < 7)
{
let_pos = word.find(letter);
if (let_pos != string::npos)
{
get_letter = word.substr(let_pos,1);
new_letter = finalstar.substr(let_pos,1);// gets star from string made of stars
new_letter = finalstar.replace(let_pos,1,letter);
cout << "Right !!" <<endl;
ct1 = ct1 ;
}
else if(let_pos == string::npos)
{
cout << "Wrong !!" << endl ;
count++ ;
draw_body_parts(count);
}
cout << "Your word is " << finalstar << endl ;
cout << "Give me a guess (letter) ---->";
cin >> letter ;
cout << endl ;
ct1++;
}
Im trying to get out of this loop before the counter stops the loop