Tuesday, November 26, 2019

CS201 Assignment 2 solution 2019



















An array of arrays is known as two-Dimensional array. In C++ it is also known as matrix. A matrix can be represented as a table of rows and columns. Like single dimensional arrays, we can store same type of data in it.  Elements stored in array can be accessed using array index. Index starts from [0][0]. Means the index of row and column starts from 0.  Following is an example of a two-dimensional array declaration and initialization having 3 rows and 3 columns.
int mularray[3][3] = {         //Declaration and initialization of a 2D Array
{1, 2, 3},
{5, 7, 9},
{0, 2, 4}
};
// The value of mularray [0][0] is 1
// The value of mularray [0][1] is 2
// The value of mularray [1][2] is 9
// The value of mularray [2][1] is 2
Problem Statement
Write an option-based program in C++ which should show following four options to the user at the start of application:
1. Press 1 to populate a two-dimensional array with integers from 1 to 100.
2. Press 2 to display the array elements.
3. Press 3 to display the largest element present in the array along with its row and column index.  
4. Press 4 to find and show the transpose of the array.

4 comments:

  1. You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. encuentro virtual con david hoffmeister

    ReplyDelete
  2. Your blog never ceases to amaze me, it is very well written and organized.:,*;~ see here now

    ReplyDelete
  3. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. https://helpmewithmyessay.com/coursework/

    ReplyDelete