+ 1
How to check the input is numbers or not?? (In c++)
4 Respostas
+ 1
string s;
cin>>s;
int num = 0;
for (int i = 0; i<s.length(); i++){
if(isdigit(s[i])){
num += 1;
}
}
if(num==s.length()){
cout << "Number";
} else {
cout << "Not a number";
}
+ 1
language?
+ 1
C++
+ 1
Thanks