如何确定数字是否真的是整数?
这是源代码:
#include <iostream>
using namespace std;
int main() {
int a;
cin>>a;
if ( /*condition i need*/) cout<<"It's an integer!";
else cout<<"You have entered a character that is not a number or a number that is not an integer(it's something like 2.2 or so)";
return 0;
}
请记住,我需要在开始时将“ a”初始化为int 我尝试使用缓冲区一些技巧,但未能解决问题