Question: I need help with this c++ task, please statement Purpose: Purpose of this Lab is to familiarize the students with the use of elementary data

I need help with this c++ task, please

I need help with this c++ task, please statement Purpose: Purpose ofthis Lab is to familiarize the students with the use of elementarydata structure- Arrays. Another aim is to teach the students how toimplement one dimensional and two- dimensional arrays. The students are given smalltasks related to 1-D and 2-D arrays which they complete during thelab session under the supervision of the lab instructor. This helps themunderstand the concepts well which they learn in their lectures. Activity Outcomes:

The students will learn how to write methods related to some actions

statement Purpose: Purpose of this Lab is to familiarize the students with the use of elementary data structure- Arrays. Another aim is to teach the students how to implement one dimensional and two- dimensional arrays. The students are given small tasks related to 1-D and 2-D arrays which they complete during the lab session under the supervision of the lab instructor. This helps them understand the concepts well which they learn in their lectures. Activity Outcomes: The students will learn how to write methods related to some actions performed on 1-D and 2-D arrays. They will understand how to write simple methods to calculate average of all elements of 1-D array and display how many elements are below and how many are above this average. count and display how many elements in 1-D array are even and how many are odd. find and swap the largest and smallest elements in 1-D array. find and display sum of each row and each column of 2-D array. display elements of row which has the largest sum of elements. display row(s) which contain(s) repeated elements. Theory Review (10 Minutes): Since an array is the basic data structure, the students are already familiar with in their previous courses, nothing can be added here as a review of this data structure. We shall practice solving some exercises related to 1-D and 2-D arrays. Practice Activity with Lab Instructor: Problem Statement: We want to create a program that will store random integers between 0 and 99 in a two dimensional array. The program should find and display sum of all elements stored in the array. Solution: Create a project with the name "ArrayProject" Inside this project, create a main class with the name SumElements and add the following code in this class main.cpp int row; 1 #include // Library used for input/output handling 2 #include // Library required to use Random Numbers function (rand():) 3 4 using namespace std; 5 6- int main() { 7 8 // Program to calculate the sum of numbers in a 2D arrays 9 18 int col; 11 12 cout > row; //input the value of rows 14 15 cout > col; //input the value of columns 17 18 int matrix[row][col]; //define a 2D array 19 20 cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!