Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- { int liczba ;
- cout<<"Podaj liczbe: ";
- cin>>liczba;
- if(!(cin>>liczba)) //dopóki strumień jest w stanie błędu -> dopóki podawane są błędne dane
- {
- cout<<"Niepoprawny znak. Podaj liczbe!: ";//ew komunikat błędu
- cin.clear(); //kasowanie flagi błędu strumienia
- cin.sync(); //kasowanie zbędnych znaków z bufora
- }
- else
- cout<<"Podana liczba to: "<<liczba<< endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement