Hi i am trying to create a program that reads in characters until the user enters the correct two character sequence (cs) to open the door. The input should be only c followed by s and also both characters. I am not sure where i am going wrong! Please help. Right now it allows access even when i enter a single word !
int main()
{
char A;
int done = 0;
cout << "You have before you a closed door !" << endl;
cin >> A;
while (!done)
{
if (A='cs')
break;
else
cin >> A;
}
cout << "Congratulations ! The door has opened !" << endl;
return 0;
}
A='cs'is your problem. Look up the comparison operator.