请问你能检查这个代码吗?try/catch/throw 有什么问题?
#include<iostream>
using namespace std;
int get_input();
int main() {
int number, base_in, base_out;
bool pass = 1;
while(pass) {
double number, base_in, base_out;
try {
cout << "What's your number? ";
number = get_input();
pass = 0;
}
catch(problem_type()) {
cout << "Please, write inputs should be integer" << endl;
}
}
return 0;
}
int get_input(bool target = 1) {
double n;
cin >> n;
if(n != (int)n) throw problem_type();
if(target) {
if(n<1) throw problem_type();
}
return (int)n;
}