Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout << "Prosze podac liczbe calkowita: ";
- int liczba;
- cin >> liczba;
- if(cin.good())
- cout << liczba << endl;
- else
- {
- cout << "Podana liczba nie byla prawidlowa, podaj jeszcze raz: ";
- cin.clear(); // opuszcza flagę błędu
- cin.ignore(9999, '\n'); // czyści bufor wejścia z dotychczas wpisanych znaków
- cin >> liczba;
- cout << liczba << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement