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.
33 lines
520 B
33 lines
520 B
#include<iostream>
|
|
#include<string>
|
|
#include<limits>
|
|
#include"xianzhi.h"
|
|
using namespace xiaozu;
|
|
using namespace std;
|
|
|
|
int xiaozu::get_line(int min, int max)
|
|
{
|
|
int result{};
|
|
while (true)
|
|
{
|
|
cin >> result;
|
|
if (!cin)
|
|
{
|
|
cin.clear();
|
|
cin.ignore(numeric_limits<streamsize>::max(), '\n');
|
|
cout << "ÇëÖØÐÂÊäÈë!" << endl;
|
|
}
|
|
if (result<min || result>max)
|
|
{
|
|
cout << "ÇëÖØÐÂÊäÈë!" << endl;
|
|
}
|
|
if (result >= min && result <= max)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
|