Hello everyone, this code is supposed to take tickets at a concert, count them, output them and say how many green/blue tickets you received. I am new and I would like some help polishing this turd. First of all, I can't get the loop to activate no matter what I type into it, then I can't get it to output the answer once I press n and try to end the loop, plus any other problems you guys find. TIA
#include <iostream>
usingnamespace std;
int main()
{
int green = 0;
int blue = 0;
char answer;
char color;
cout << "start counting tickets? (y/n)" << endl;
cin >> answer;
while (answer == 'y', 'Y')
{
cout << "enter b for blue and g for green " << endl;
cin >> color;
if (color == 'b')
{
blue++;
}
if (color == 'g')
{
green++;
}
else
{
cout << color << " is not a valid input, try 'b' or 'g'." << endl;
}
cout << "Continue counting tickets? (y/n)" << endl;
cin >> answer;
}
cout << blue << " blue tickets, " << green << " green tickets today. " << endl;
return 0;
}