Back to Browse

Practical@Lesson 10: 1D array & 2D array in solving application problems

223 views
Jul 25, 2020
26:38

Link to install Visual Studio with C++: https://youtu.be/ThmtfSdKuGo Question 1: 1D array Write a C++ program to create an array named Mark which can store 5 marks for 5 students and initialize it to 0. Then perform the following tasks: a. Using a for loop, store 5 students marks entered by user into the Mark array. Display the marks in the array. b. Display the student marks in the Mark array in reverse order. c. Ask users to change any student’s mark? If yes = prompt user to enter a new mark for this particular student which will change the original mark. Question 2: 2D array Suppose the weekly hours for all employees are stored in a two-dimensional array. Each row records an employee’s seven-day work hours with seven columns. For example, the following array stores the work hours for THREE (3) employees. Write a C++ program that displays employees and their total hours worked. Initialize the array with the values shown in the following table. Sun Mon Tue Wed Thu Fri Sat Employee 1 7 3 4 3 3 4 4 Employee 2 3 3 4 3 3 2 2 Employee 3 9 3 4 7 3 4 1

Download

0 formats

No download links available.

Practical@Lesson 10: 1D array & 2D array in solving application problems | NatokHD