Contact: aviboots(AT)netvision.net.il
39,950 questions
51,892 answers
573 users
#include <iostream> int main() { std::string str = "12"; try { int n = stoi(str); std::cout << (n >= 0 ? "yes" : "no") << "\n"; std::cout << (n >= 0) << "\n"; } catch(...) { std::cout << "Not a number" << "\n"; } } /* run: yes 1 */