I am trying the follow program. When I run this program compiler gives me a error that y and Y are not declared in this scope. So, I am following all the instructions which are given in book "Problem Solving With C++ by Walter Savitch" then why I am facing this error?
#include <iostream>
usingnamespace std;
int main()
{
int end_p;
char ans;
do
{
cout << "Hello.\n";
cout << "Do you want another greeting?\n";
cout << "Type y for Yes and n for No and press enter key.\n";
cin >> ans;
} while ( (ans == y) || (ans == Y) );
cout << "Good bye\n";
cin >> end_p;
return 0;
}