Aleksandr_Grigoryev

Возрастает\Убывает

Feb 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     const int n = 10;
  6.     int a[n] = { 1,2,3,4,5,6,7,8,9,10 };
  7.     bool b = true;
  8.     for (int i = 1; i<n&&b; i++)
  9.     {
  10.         if (a[i]>a[i - 1])
  11.             b=false;
  12.     }
  13.     if (b)
  14.         cout << "Massiv ubivaet" << endl;
  15.     bool q = true;
  16.     for (int i = 1; i<n&&q; i++)
  17.     {
  18.         if (a[i]<a[i - 1])
  19.             q = false;
  20.     }
  21.     if (q)
  22.         cout << "Massiv vozrastaet" << endl;
  23.     system("pause");
  24.     return 0;;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment