Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ДЛЯ ВЕРЫ И ИРИШКИ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- #include "stdafx.h"
- #include <iostream>
- #include <time.h>
- using namespace std;
- void main()
- {
- srand(time(NULL));
- setlocale(LC_ALL, "rus");
- int arr[30];
- int summ = 0;
- bool p = false;
- cout << "Исходный массив: ";
- for (int i = 0; i < 30; i++)
- {
- arr[i] = rand() % 10000;
- }
- for (int i = 0; i < 30; i++)
- {
- if (arr[i] < 200 && arr[i]%5==0)
- {
- p = true;
- }
- }
- if (p == false)
- {
- arr[0] = 195;
- arr[1] = 150;
- }
- for (int i = 0; i < 30; i++)
- {
- cout << arr[i] << " ";
- }
- for (int i = 0; i < 30; i++)
- {
- if (arr[i] < 200 && arr[i] % 5 == 0)
- {
- summ += arr[i];
- }
- }
- for (int i = 0; i < 30; i++)
- {
- if (arr[i] < 200 && arr[i] % 5 == 0)
- {
- arr[i] = summ;
- }
- }
- cout << endl;
- cout << endl;
- cout << "Преобразованный: ";
- cout << endl;
- for (int i = 0; i < 30; i++)
- {
- cout << arr[i] << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement