Код ниже. Результат работы на скриншоте.
#include <iostream>//cin
#include <cstdlib> //rand()
#include <ctime>//time()
using namespace std;
#define N 5 // Количество элементов в массиве
int main() {
int Arr[N];
srand(static_cast<unsigned int>(time(0))); //Инициализация генератора случайных чисел
cout << "Исходный массив: ";
for(int i = 0; i < N; ++i){
Arr[i] = rand(); //Заполнение случайными числами
cout << Arr[i] << " ";
}
cout << endl;
bool flag = true;
for(int i = 0; i < N - 1; ++i){
if(Arr[i] > Arr[i+1]){
flag = false;
break;
}
}
cout << "Последовательность " << (flag ? " НЕубывающая. " : "не образуется") << endl;
return 0;
}
dc:set of char;
s1,s2:string;
i:integer;
begin
dc:=['A'..'D','a'..'d'];
s1:='То avoid the impression of the tail wagging the dog, '+
'the president cannot be seen bending to the wishes of a minority.';
s2:='';
for i:=1 to length(s1) do
if not(s1[i] in dc) then s2:=s2+s1[i];
Writeln('Исходная строка: ',s1);
s1:=s2;
Writeln('Результирующая строка: ',s1)
end.
Тестовое решение:
Исходная строка: То avoid the impression of the tail wagging the dog, the president cannot be seen bending to the wishes of a minority.
Результирующая строка: То voi the impression of the til wgging the og, the presient nnot e seen ening to the wishes of minority.