Question: Use a for loop to fill the array with numbers 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2,
Use a for loop to fill the array with numbers 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2. Complete the code below.
#includeusing namespace std; void print_array(int a[], int size); int main() { const int SIZE = 18; int x[SIZE]; for (.......) { x[i] = .....; } printArray(x, SIZE); return 0; } /** Prints an array of comma separated int. @param a the array of strings @param size the size of the array */ void printArray(int x[], int size) { cout << "["; if (size > 0) { cout << x[0]; for (int i = 1; i < size; i++) { cout << ", " << a[i]; } } cout << "]" << endl; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
