






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is lab manual in form of lecture slides for Introduction to Programming course. It was delivered by Prof. Abhimoda Arora at Alagappa University. It includes: Multidimensional, Arrays, Variable, Specifies, Dimensions, Element, Districts, Sales, Checkerboard, Indexes
Typology: Exercises
1 / 12
This page cannot be seen from the preview
Don't miss anything!







๎ weโve looked at arrays of one dimension: A single variable specifies each array element. ๎ Arrays can have higher dimensions.
#include
๎ The array is defined with two size specifiers, each enclosed in brackets: ๎ double sales[DISTRICTS][MONTHS]; ๎ You can think about sales as a two-dimensional array, laid out like a checkerboard.
Accessing Multidimensional Array Elements ๎ Array elements in two-dimensional arrays require two indexes: ๎ sales[d][m] ๎ Notice that each index has its own set of brackets. Commas are not used. Donโt write sales[d,m] ; this works in some languages, but not in C++.
Initializing Multidimensional Arrays ๎ As you might expect, you can initialize multidimensional arrays. ๎ The only prerequisite is a willingness to type a lot of braces and commas.
๎ Write a code to generate a 5 x 5 matrice. Program should ask for every value and then display it in a matrice form.
๎ Write a program to add two matrices of 5 x 5 order. Make your logic using loops