#include <stdlib.h>
#include <time.h>
#include <vector>
#include <iostream>
using namespace std;
int main(int argc, char* argv[]) {
int n;
cout << "Input n: ";
cin >> n;
vector<double> v(n);
srand((unsigned) time(NULL));
int random_limit = 100;
cout << "Initial array:" << endl;
for(int i=0; i<n; i++) {
v[i] = double(rand()%random_limit) + 1.0/double(rand()%random_limit + 1);
cout << v[i] << endl;
}
bool is_decrease = true;
for(int i=n-1; i>1; i--) {
if(v[i] > v[i-1]) {
is_decrease = false;
break;
}
}
cout << endl << "Is decreasing sequence: " << ((is_decrease) ? "true" : "false") << endl;
return 0;
}
Если Вы уже зарегистрированы на Портале - войдите в систему, если Вы еще не регистрировались - пройдите простую процедуру регистрации.