Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The user enters 9 integers to fill in a 3 x 3 grid; determine the totals horizon

ID: 3661326 • Letter: T

Question

The user enters 9 integers to fill in a 3 x 3 grid; determine the totals horizontally and vertically. For example: 1 | 2 | 3 = 6 4 | 5 | 6 = 15 7 | 8 | 9 = 24 --|---|-- 12 15 18 I'm using Microsoft Visual Studio. So far, this is my code. #include using namespace std; int main() { int cols; int num[9]; int number; int counter = 0; int rows = 0; int size = 3; while (counter < 9) { cout << "Enter a number between 0 and 100: "; cin >> number; while ((number < 0) || (number > 100)) { cout << "Please enter a number between 0 and 100: "; cin >> number; } num[counter] = number; counter = (counter + 1); } while (rows < size) { cols = 0; while (cols < size) { cols = (cols + 1); cout << cols << " | "; } rows = (rows + 1); cout << endl; } system("pause"); return 0; }

Explanation / Answer

#include using namespace std; int main() { int cols; int num[9]; int number; int counter = 0; int rows = 0; int size = 3; while (counter < 9) { cout > number; while ((number < 0) || (number > 100)) { cout > number; } num[counter] = number; counter = (counter + 1); } while (rows