C/C++

ПОМОГИТЕ ОЧЕНЬ СРОЧНО C++.

2,3,4,5 использовать только простые операции C++
// 1
#include <iostream>
#include <ctime>
using namespace std;
int main() {
int ar[50];
cout << "Enter a size of the array (no more than 50: ";
int size;
cin >> size;

srand(time(0));
for (int i = 0; i < size; ++i) {
ar[i] = rand() % 35 - 7;
cout << ar[i] << " ";
}
cout << "\n";

for (int i = 0; i < size; ++i) {
if (i % 2 == 0 || i % 3 == 0) ar[i] += ar[2];
cout << ar[i] << " ";
}
cout << "\n";
}

// 2
#include <iostream>
#include <numeric>
#include <ctime>
using namespace std;
int main() {
int ar[50];
cout << "Enter a size of the array (no more than 50: ";
int size;
cin >> size;
cout << "Enter the range from A to B separated by a space: ";
int a, b;
cin >> a >> b;

srand(time(0));
for (int i = 0; i < size; ++i) {
ar[i] = rand() % (b-a+1) + a;
cout << ar[i] << " ";
}
cout << "\n";

int ind = 0;
for (int i = 0; i < size; ++i)
if(ar[i] <= ar[ind]) ind = i;

cout << "Sum: " << accumulate(ar+ind+1, ar+size, 0) << "\n";
}

// 3
#include <iostream>
#include <ctime>
using namespace std;
int main() {
int ar[50];
cout << "Enter a size of the array (no more than 50: ";
int size;
cin >> size;

int ind = 0, cnt = 0;
srand(time(0));
for (int i = 0; i < size; ++i) {
cout << (ar[i] = rand() % 21 + 1) << " ";
if ((~ar[i] & 1) && (cnt++ < 2)) ind = i;
}
cout << "\n";

for (int i = ind; i+1< size; ++i) ar[i] = ar[i+1];

for (int i = 0; i < size; ++i) cout << ar[i] << " ";
cout << "\n";
}

// 4
#include <iostream>
#include <ctime>
using namespace std;
int main() {
int ar[51];
cout << "Enter a size of the array (no more than 50: ";
int size;
cin >> size;

srand(time(0));
for (int i = 0; i < size; ++i)
cout << (ar[i] = rand() % 21 + 1) << " ";
cout << "\n";

for (int i = size++; i > 3; --i) ar[i] = ar[i-1];
ar[3] = ar[0];
for (int i = 0; i < size; ++i) cout << ar[i] << " ";
cout << "\n";
}

// 5
#include <iostream>
#include <ctime>
using namespace std;
int main() {
int ar[51];
cout << "Enter a size of the array (no more than 50: ";
int size;
cin >> size;

srand(time(0));
for (int i = 0; i < size; ++i)
cout << (ar[i] = rand() % 31 - 15) << " ";
cout << "\n";

sort(ar, ar+size/2);
sort(ar+size/2, ar+size);

for (int i = 0; i < size; ++i) cout << ar[i] << " ";
cout << "\n";
}
ВГ
Владимир Гудин
6 243
Лучший ответ
Привет

по 50 рублей за задачу накинешь? пришлю ответы правильные