I ran into a problem, I can’t remove two even elements of the array, an error is displayed and the exact stop is called. Please help. Code:
int main() { using namespace std; int size, rez, cheker; cout << "Input the size of the massive"; cin >> size; int*a = new int[size]; for (int i = 0;i <= size;i++) { a[size] = i; cheker = i % 2; if (cheker == 0) { cout << "The even numbers are\n" << a[size]; int*b = new int[size-2]; for (i = 0;i <= size;i += 2) { b[size] = i; } a = b; cout << "The deleted numbers are:" << b[size]; } } system("pause"); return 0; }
a[size]- departure outside the array.b[size]- departure beyond the array. - AnT 2:38