Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int wiek;
- cout << "Napisz ile masz lat: ";
- cin >> wiek;
- if(cin.fail()) // cin.fail() zwraca prawdę (true) jeżeli wystąpił błąd w buforze wejścia
- cout << "Podales niepoprawna liczbe!\n";
- else
- cout << "Masz " << wiek << " lat\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment