using namespace std;
#include <iostream>
#include <string>
int main()
{
char choice;
string category;
while (true)
{
cout << "Enter the letter of the movie category: ";
getline(cin, category);
if (!category.empty())
{
choice = category.front();
switch (choice)
{
case 'A':
category = "Adventure";
break;
case 'C':
category = "Comedy";
break;
case 'F':
category = "Family";
break;
case 'H':
category = "Horror";
break;
case 'S':
category = "Science and Function";
break;
default:
cout << "There is no category for this char. Categories are available under the chars A, C, F, H and S. Please re-enter.\n\n";
continue;
}
cout << "You have chosen the " << category << " movies category.\n\n";
}
else
{
cout << "Empty input. Please re-enter.\n\n";
}
}
}
Comments
Leave a comment