char answer[70];
while(answer == 'Yes'){
if (a== 136)
{
wichita.pedal();
}
else if (a == 236)
{
std::cout << "hello";
wichita.fly();
}std::cout<< "Would you like to go on? Yes or no"
std::cin>> answer;
}
return 0;
}
and then I get ISO C++ forbids comparison between pointer and integer.
What i'm trying to do is if they reply with a "Yes" then we will start this procedure over. I used a character array "answer[80]" for the cin. How do I fix this?
thansk shack. can you give me an example how i could do this? just for future references? like, say, if i were to have options of "Yes" and "No" and to have them write in Yes or No and have the effects of the Yes and No.
Like, how do that with examples? My book doesnt talk about strcmp or strncmp at all.
The above case would be true if the first three characters in "answer" are "Yes". And similarly for "No":
if( strcmp(answer, "No") == 0 )
Of course, using strings is easier because you can use the == operator between a string and a char* or a char[], plus there's the benefit of it doing its own dynamic memory for you.
Shack, when I do this this function, it asks me to repeat twice, and then when I type Yes for both, it just repeats nonstop. Here's my code if you want to see what I'm talking about.