#include <iostream>
using namespace std;
void print_array(int* array, int size)
{
for(int i = 0;i<size;i++)
cout << array[i] << "\t";
}
cout << endl;
int main(int argc, char** argv) {
int n;
cout << "Введите количество элементов в массиве: ";
cin >> n;
int* array = new int[n];
int* copy = new int[n];
for(int i = 0;i<n;i++)
cout << "Введите элемент ["<< i <<"]: ";
int number;
cin >> number;
array[i] = number;
if(number < 0)number = -number;
copy[i] = number < 10 ? number : 0;
cout << "До: ";
print_array(array,n);
cout << "После: ";
print_array(copy,n);
delete[] array;
delete[] copy;
return 0;
#include <iostream>
using namespace std;
void print_array(int* array, int size)
{
for(int i = 0;i<size;i++)
{
cout << array[i] << "\t";
}
cout << endl;
}
int main(int argc, char** argv) {
int n;
cout << "Введите количество элементов в массиве: ";
cin >> n;
int* array = new int[n];
int* copy = new int[n];
for(int i = 0;i<n;i++)
{
cout << "Введите элемент ["<< i <<"]: ";
int number;
cin >> number;
array[i] = number;
if(number < 0)number = -number;
copy[i] = number < 10 ? number : 0;
}
cout << "До: ";
print_array(array,n);
cout << "После: ";
print_array(copy,n);
delete[] array;
delete[] copy;
return 0;
}