You are on page 1of 2

Computer Science (083)

Ass #8 - 2-D Array & Structure


1. Write a menu driven program in C++ that uses functions to do the following in a 2D
array :
a. Display Sum of each row and Overall sum
void RowSum (int A[][MAX] , int R, int C);
b. Display Sum of each column and Overall sum
void ColSum (int A[][MAX] , int R, int C);
c. sum of major and minor diagonal
void DiagonalSum (int A[][MAX] , int R, int C);
2. Write a program in C++ using function that will displays the maximum and minimum
value stored in 2-D array.
void MaxMin (int A[][MAX] , int R, int C);
3. Write a program in C++ using function that returns the product of non-zero elements
stored in 2-D array.:
void Product (int A[][MAX] , int R, int C);
4. Write a program in C++ that uses a function :
Time Add (Time T1, Time T2);
To add and return the sum of two given times in hours and minutes.
For Example,
First Time: 3 Hours 40 Minutes
Second Time: 4 Hours 50 Minutes
Then,
Total Time: 8 Hours 30 Minutes
5. Write a program in C++ to uses the function
int CubicFeet ( volume V); To display the volume in cubic feet (Feet3).
The structure volume has three members; length, breadth and height; all given in feet and
inches. Use the concept of nesting of structures.
6. Write a program in C++ that uses the function :
void Average( Student S[] , int N );
To accept the details of the students in an array of structure and display the average marks
of each student. Assume the following definition of structure Student
struct Student
{
long RollNo;
char Name[20];
float marks[5];
};

7. Write a program that uses a function :


Emp Maximum( Emp E[] , int N);
To accept the details of the employee in an array of structure and returns the details of the
employee having maximum salary. Now display his details in the main () function..
Assume the following definition of structure Employee
struct Employee
{
long EmpNo;
char Name[20];
float salary;
};

You might also like