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

C++ program A. Declare a multidimensional array with 5 rows and 6 columns. B. Us

ID: 3694613 • Letter: C

Question

C++ program A. Declare a multidimensional array with 5 rows and 6 columns.

B. Using Row major order initialize all elements to 100 if the index for the Row and index for the Column are both even

C.  Using Column major order initialize all elements to 300 if the index for the Row or the index for the Column is odd. C++ program A. Declare a multidimensional array with 5 rows and 6 columns.

B. Using Row major order initialize all elements to 100 if the index for the Row and index for the Column are both even

C.  Using Column major order initialize all elements to 300 if the index for the Row or the index for the Column is odd. A. Declare a multidimensional array with 5 rows and 6 columns.

B. Using Row major order initialize all elements to 100 if the index for the Row and index for the Column are both even

C.  Using Column major order initialize all elements to 300 if the index for the Row or the index for the Column is odd.

Explanation / Answer

#include<iostream>
main()
   {
   int matrix[5][6]={0},i,j;
   for(i=0;i<5;i++)       //row mejor order
       {
       for(j=0;j<6;j++)
           {
           if(i%2 == 0 && j%2 ==0)
               matrix[i][j]=100;
           }
       }
  
   for(i=0;i<5;i++)       //column mejor order
       {
       for(j=0;j<6;j++)
           {
           if(i%2 != 0 && j%2 !=0)
               matrix[j][i]=300;
           }
       }
  
   }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote