You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
575 B
34 lines
575 B
# include "myio.h"
|
|
|
|
int mycin(int min, int max, string p)
|
|
{
|
|
int choice{};
|
|
while (true)
|
|
{
|
|
cout << p;
|
|
cin >> choice;
|
|
if (cin.fail())
|
|
{
|
|
cin.clear();
|
|
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
|
|
cout << "ÄãÊÇ£¿" << endl;
|
|
system("pause");
|
|
system("cls");
|
|
Menu();
|
|
continue;
|
|
}
|
|
else if (choice > max || choice < min)
|
|
{
|
|
cout << "ÄãÊÇ£¿" << endl;
|
|
system("pause");
|
|
system("cls");
|
|
Menu();
|
|
continue;
|
|
}
|
|
if (choice >= min && choice <= max)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return choice;
|
|
} |