#include
template< typename int_dt >
int_dt *
transform(int_dt *arr, size_t n)
{
int_dt *new_arr = new int_dt[n];
for (int i = 0; i < n; i++) {
new_arr[i] = arr[i] % 5 ? arr[i] : 2 * arr[i];
}
return new_arr;
}
int
main(void)
{
enum
{
ARR_SIZE = 10
};
int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int *b = transform(a, ARR_SIZE);
for (int i = 0; i < ARR_SIZE; i++) {
printf("%d ", b[i]);
}
delete[] b;
return 0;
}