Facebook
From Melodic Parrot, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 184
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {   int x,y=1,ros=0,mal=0;
  7.     cout << "Program sluzy do sprawdzenia czy ciag jest rosnacy malejacy lub mieszany" << endl;
  8.     cout<<"Podaj liczby ciagu : ";
  9.     cin>>x;
  10.     while(y!=0)
  11.         {
  12.  
  13.             cout<<"Podaj kolejna liczbe :";
  14.             cin>>y;
  15.             if(y==0)
  16.             {
  17.                 break;
  18.             }
  19.             if(y>x)
  20.             {
  21.                ros=ros+1;
  22.  
  23.             }
  24.             else
  25.             {
  26.                 mal=mal+1;
  27.             }
  28.  
  29.             x=y;
  30.         }
  31.         if(ros==0)
  32.         {
  33.             cout<<"Ciąg malejacy";
  34.  
  35.         }
  36.         else if(mal==0)
  37.         {
  38.             cout<<"Ciag rosnacy";
  39.         }
  40.         else
  41.         {
  42.             cout<<"Ciag mieszany";
  43.         }
  44.     return 0;
  45. }