Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "Uzytkowniku, wpisz ile masz lat: ";
- int wiek;
- cin >> wiek;
- while(cin.fail()) // dopóki jest błąd pobierania
- {
- cout << "Podales(as) niepoprawna liczbe. Wpisz jeszcze raz: ";
- cin.clear();
- cin.ignore(99999, '\n');
- cin >> wiek;
- }
- cout << "Masz " << wiek << " lat. Jestes ";
- if(wiek >= 18)
- cout << "pelnoletni(a).\n";
- else
- cout << "niepelnoletni(a).\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement