The below code works for every character I type in except for £
or ?
.
Why do I get a "debug assertion fail"?
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
string input;
while (1) {
cout << "Input number: ";
getline(cin, input);
if (!isdigit(input[0]))
cout << "not a digit
";
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…