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

I\'m so lost.. could anyone please help me with this intro to C++ homework probl

ID: 3845993 • Letter: I

Question


I'm so lost.. could anyone please help me with this intro to C++ homework problem?

create a program that displays a table consisting of four rows and five columns. The first column should display the numbers through 4. The second and sub- sequent columns should display the result of multiplying the number in the first column by the numbers 2 through 5.1f necessary, create a new project nam Introductory 14 Project, and save it in the p08 folder. Enter instructions into a source file named Also enter appropriate comments and any additional instructions required by the compiler. Save and then run the program.

Explanation / Answer

#include <iostream>
using namespace std;

int main() {
// As this is introduction to C++
// I guess this program is introduction to for loop.
   // steps:
   // 1) Declare array to store values
   // we need to store following matrix as indicated in questions
   //1 2 3 4 5
   //2 4 6 8 10
   //3 6 9 12 15
   //4 8 12 16 20
   // 2) Print using for loop
  
   //Step 1: declare integer 2 Dimentional array
   int arr[4][5]={{1,2,3,4,5},{2,4,6,8,10},{3,6,9,12,15},{4,8,12,16,20}};
  
   // Step 2: Print array using for loop
   for(int i=0;i< 4 /*Number of rows */;i ++)
   {
   for(int j=0;j<5 /*Number of columns*/;j++)
   {
   cout<<arr[i][j];
   cout<<" "; //add space between 2 number
   }
   cout<<" ";
   }
   return 0;
}

Output:

1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20

Dear friend,

I have added required comments in code itself. Hope this will help you.