Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- do
- {
- cin.clear();
- cin.sync();
- cin>> nr_char;
- n=atof(nr_char);
- cout<<"nnnnnn wynosi "<<n<<endl;
- nr_db=n; //przypisanie intowi liczby double
- cout<<"nr_db wynosi "<<nr_db<<endl;
- if(cin.fail() || atof(nr_char)==0 || nr_db<=0)
- {
- cout<<"Podaj poprawna liczbe"<<endl;
- }
- else if(n-nr_db!=0)
- {
- cout<<"Liczba musi byc calkowita."<<endl;
- }
- else if(n<=0)
- {
- CZERWONY;
- cout<<"Liczba musi byc dodatnia"<<endl;
- }
- else
- cout<<"404 error"<<endl;
- }while(cin.fail() || atof(nr_char)==0 || nr_db-n!=0 || n<=0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement