@Хедин
74 / 69 / 36
Регистрация: 17.05.2014
Сообщений: 301
|
23.06.2014, 19:56
|
|
markeloff1337,
C++ | 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| void check(int *a, int n)
{
bool less = true, nobig = true, big = true, noless = true;
for (int i = 1; i < n; i++)
{
if (less && a[i] >= a[i-1]) less = false;
if (nobig && a[i] > a[i-1]) nobig = false;
if (big && a[i] <= a[i-1]) big = false;
if (noless && a[i] < a[i-1]) noless = false;
if (!less && !nobig && !big && !noless) { cout << "Вообще хрень, а не последовательность" << endl; break; }
}
if (less) cout << "Убывающая" << endl;
if (nobig) cout << "Невозрастающая" << endl;
if (big) cout << "Возрастающая" << endl;
if (noless) cout << "Неубывающая" << endl;
} |
|
0
|