#include <iostream>
#include<climits>
#include<cstdio>
using namespace std;
bool is_int(long long);
int main()
{
long long theOne;
cout << "EOF means ending"<<endl;
cout << "Please input the test number:"<<endl;
cin >> theOne;
while(theOne!=EOF)
{
if(is_int(theOne))
cout << "YES"<<endl;
else
cout << "Out of range"<<endl;
cin.clear();
cin >>theOne;
}
return 0;
}
bool is_int(long long x)
{
if(x>=INT_MIN&&x<=INT_MAX)
return true;
else
return false;
}
C++ 判断一个数是否在int的取值范围内
最新推荐文章于 2024-03-24 15:00:39 发布