Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- #include <time.h>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "rus");
- srand(time(NULL));
- int n, data[100], k1;
- cout << "Введите n: ";
- cin >> n;
- cout << "Исходный массив: " << endl;
- for (int i = 0; i < n; i++) {
- data[i] = rand() % 20 - 10;
- cout << data[i] << ' ';
- }
- cout << endl;
- cout << "Введите k1: ";
- cin >> k1;
- for (int i = 0; i < n; i++) {
- if (data[i + 1] < 0)
- data[i] = k1;
- cout << data[i] << ' ';
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement