Advertisement
MeehoweCK

Untitled

Jul 15th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     cout << "Prosze podac liczbe calkowita: ";
  8.     int liczba;
  9.     cin >> liczba;
  10.     if(cin.good())
  11.         cout << liczba << endl;
  12.     else
  13.     {
  14.         cout << "Podana liczba nie byla prawidlowa, podaj jeszcze raz: ";
  15.         cin.clear();                // opuszcza flagę błędu
  16.         cin.ignore(9999, '\n');     // czyści bufor wejścia z dotychczas wpisanych znaków
  17.         cin >> liczba;
  18.         cout << liczba << endl;
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement