Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void replaceWith100(int* arr, int size) {
- for (int i = 0; i < size; i++) {
- if (arr[i] < 0) {
- arr[i] = 100;
- }
- }
- }
- int main() {
- int size;
- cout << "Введите размер: ";
- cin >> size;
- int* array = new int[size];
- cout << "Введите содержимое: " << endl;
- for (int i = 0; i < size; i++) {
- cout << i << ": ";
- cin >> array[i];
- }
- replaceWith100(array, size);
- cout << "Получившийся массив: ";
- for (int i = 0; i < size; i++) {
- cout << array[i] << " ";
- }
- delete[] array;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement