I keep getting stuck in an infinite loop with the code. I have to make it so you can exit using the sentinel 'q' but not iterate more than 20 times. Any help will be appreciated as I'm only new to programming.
#include <iostream>
using namespace std;
int main()
{
int option; // If new member or existing member or exit
char SENTINEL = 'q';
while(option != SENTINEL)
{
for(int count = 0; count <= 20; count++)
{
// Display menu
cout << "Welcome to the forum.\n";
cout << "Are you:\n";
cout << "1. A new member\n";
cout << "2. An existing member" << endl;
cout << "To exit press 'q'\n";
cin >> option;
if (option == 1)
{
char new_name[20]; // Array to hold new member
cout << "You're a new member.\n";
cout << "Please enter your first name followed ";
cout << "by your last name.\n";
cout << "Then press return.\n";
cin >> new_name; // User enter their name
}
else if (option == 2)
{
cout << "You're an existing member." << endl;
}
}
}
}