Hello, I really need help. If anyone could, please tell me what I'm doing wrong.
Well, I'm making this program that asks if you're happy. Then if you don't answer yes, it will ask the question again until you do. I thought that it would be fun to have a program that forces you to say yes, like most questions people ask you.
Anyway, the program goes wrong here: It just repeats the question over and over again before you can answer it! Please tell me what's wrong.
#include <iostream>
using namespace std;
int main()
{
string dude;
bool repeatit=true;
while (repeatit==true)
cout<< "Are you happy?";
cin>>dude;
if (dude=="yes")
cout<< "Yay!";
repeatit=false;
if (dude=="no")
cout<<"No, you're happy. Try again.";
if (dude!="yes" and dude!="no")
cout<< "Answer in yes or no only.";
system("pause");
}
Please help me!