Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find the problems with this program and its function #include #include // used to format output in neat columns using namespace std; // constants for

Find the problems with this program and its function

#include

#include // used to format output in neat columns

using namespace std;

// constants for array

const int ROW = 5;

const int COL = 5;

void showArray(int arr[][]);

int main() {

// define the array in main int arr[ROW][COL];

for(int i = 1; i <= ROW; i++) { for(int j = 1; j <= COL; j++) { arr[i][j] = 2 * i + j; } }

showArray(arr);

return 0; }

// function to display array, using setw to align columns void showArray(int arr[][COL]) { // loop to output the rows, one at a time for(int i = 0; i < ROW; i++) { // loop to output the values in that row for(int j = 0; j < COL; j++) { cout << setw(4) << arr[i][j]; }

// end this line of output cout << endl; }

// put final endline after table cout << endl; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

Were all members comfortable brainstorming in front of each other?

Answered: 1 week ago

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago