Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. do
  2.     {
  3.     cin.clear();
  4.     cin.sync();
  5.     cin>> nr_char;
  6.     n=atof(nr_char);
  7.     cout<<"nnnnnn wynosi "<<n<<endl;
  8.     nr_db=n; //przypisanie intowi liczby double
  9.         cout<<"nr_db wynosi "<<nr_db<<endl;
  10.     if(cin.fail() || atof(nr_char)==0 || nr_db<=0)
  11.     {
  12.         cout<<"Podaj poprawna liczbe"<<endl;
  13.     }
  14.     else if(n-nr_db!=0)
  15.     {
  16.         cout<<"Liczba musi byc calkowita."<<endl;
  17.     }
  18.     else if(n<=0)
  19.     {
  20.         CZERWONY;
  21.         cout<<"Liczba musi byc dodatnia"<<endl;
  22.     }
  23.     else
  24.         cout<<"404 error"<<endl;
  25.     }while(cin.fail() || atof(nr_char)==0 || nr_db-n!=0 || n<=0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement