C
colo.avs96
Hello All,
I am a noob with programming and just starting to learn. My teacher
wants us to make a program that will keep asking the user if they want
to quit. Below is my code so far. My problem is the loop will repeat
with any valuse given. If anyone could help it would be greatly
appreciated. Thank you
#include <iostream>
using namespace std;
char main()
{
char ans;
do
{
cout << "Would you like to quit? (y/n)" << endl;
cin >> ans;
}
while ((ans = 'n')&&(ans = 'N'));
return 0;
}
I am a noob with programming and just starting to learn. My teacher
wants us to make a program that will keep asking the user if they want
to quit. Below is my code so far. My problem is the loop will repeat
with any valuse given. If anyone could help it would be greatly
appreciated. Thank you
#include <iostream>
using namespace std;
char main()
{
char ans;
do
{
cout << "Would you like to quit? (y/n)" << endl;
cin >> ans;
}
while ((ans = 'n')&&(ans = 'N'));
return 0;
}