I am currently working on a C++ project in visual studio 2019 which is about star patterns. there is 6 patterns to be printed and user must select them by entering the patterns number. I noticed that my professor's program automatically closes when user press 7. How would I code that? I only know using return 0 gets me "Press Any Key to Continue". but in my professors program which is in .exe format the console immediately closes after pressing 7 without showing "Press any key to continue.."
this is my code..
int main()
{
while (choice != 7) {
cout << "Enter your choice\n";
cout << "1.Rectangle 1\n"
<< "2.Rectangle 2\n"
<< "3.Rectangle 3\n"
<< "4.Rectangle 4\n"
<< "5.Rhomb(only odd)\n"
<< "6.circle \n"
<< "7.close Application\n\n";
cin >> choice;
cout << "Enter the dimension\n";
cin >> dimension;
switch (choice) {
case 1:
Rectangle_1();
break;
case 2:
Rectangle_2();
break;
case 3:
Rectangle_3();
break;
case 4:
Rectangle_4();
break;
case 5:
Rectangle_5();
break;
case 6:
Rectangle_6();
break;
default:
break;
}
system("cls");
}
}