25 lines
500 B
C
25 lines
500 B
C
|
#pragma once
|
|||
|
#include <string>
|
|||
|
#include <stdexcept>
|
|||
|
|
|||
|
class CheckDataType
|
|||
|
{
|
|||
|
public:
|
|||
|
static bool CheckToInt(const std::string& input){
|
|||
|
try {
|
|||
|
int ret = stoi(input);
|
|||
|
return true;
|
|||
|
}
|
|||
|
catch (const std::invalid_argument& e) {
|
|||
|
printf("input is not number...\n");
|
|||
|
return false;
|
|||
|
}
|
|||
|
catch (const std::out_of_range& e) {
|
|||
|
printf("input number is out of int range...\n");
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
};
|
|||
|
|