Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <regex>
- using namespace std;
- #define DOT "."
- int main(int argc, char *argv[])
- {
- int number;
- string value;
- cout << "Zadejte číslo: ";
- cin >> value;
- cout << "Hodnota je: " << value << DOT << endl;
- regex reg("^[0-9]+$");
- if(regex_match(value, reg))
- {
- number = atoi(value.c_str());
- cout << "Zadané číslo je " << number << DOT << endl;
- }else cout << "Hodnota musí být číslo" << DOT << endl;
- system("PAUSE");
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement