i want to programme like this
but i dont know how to use char or string with if else statement:
user will open this program and programme will say "do you want to register"
and user will write yes or no and programme will exit or continue
i wrote an code like this but it doesnt work (this is a programme's basically logic):
#include <iostream>
using namespace std;
int main ()
{
cout << "do you want to register";
char test;
cin >>test;
if(test=='yes')
{
cout << "you said yes";
}
if(test=='no')
{
cout << "you said no";
}
}
or
and i wrote this and it also didnt work:
#include <iostream>
using namespace std;
int main ()
{
string answer;
cout << "do you want to register";
cin>>answer ;
if(answer == yes)
{
cout "you said yes";
}
if(answer == no)
{
cout "you said no";
}