0% found this document useful (0 votes)
24 views2 pages

Lab 13: Exercise: Total 100 Marks

The document outlines 4 tasks for a lab exercise. Task 1 involves matrix operations like addition and subtraction. Task 2 checks if a matrix is symmetric. Task 3 calculates student grades based on quiz scores. Task 4 implements a basic 2-player tic-tac-toe game.

Uploaded by

hazyhazy9977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Lab 13: Exercise: Total 100 Marks

The document outlines 4 tasks for a lab exercise. Task 1 involves matrix operations like addition and subtraction. Task 2 checks if a matrix is symmetric. Task 3 calculates student grades based on quiz scores. Task 4 implements a basic 2-player tic-tac-toe game.

Uploaded by

hazyhazy9977
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

LAB 13: EXERCISE

Total = 100 marks

Task 1: Matrix Operation [25 marks]


Write a program to fill an array of size 3x3 and then a function printer used to print any 3x3 array in the
following form:

Write two functions named as addition and subtraction used to add and subtract two 3x3 arrays. The
functions should also have the capability of printing the resultant arrays in the same form depicted
above. Test the functions in main afterwards.

Task 2: Symmetry [25 marks]


Symmetric matrix is a square matrix which remains same even after interchanging each row elements
with respective column elements or vice versa. You can say a symmetric matrix is always equal to its
transpose. The entries of symmetric matrix are symmetric with respect to its main diagonal. Write a
C++function that takes in a square matrix (4 by 4) and informs whether it is symmetric or not after
checking.

Task 3: Grade Calculator [25 marks]


In this task, you are supposed to create a function that takes in marks for 3 students in their 3 quizzes.
The one with the highest score gets an A, while the second gets a B and the lowest ends up with up a C
:/. Print each student’s grade and their average in the end in the main function.

Prototype function: void mean_calculator( int data[][3],int average[]);

void grade_calculator (int average[], string grade[]);


Task 4: Tic Tac Toe [25 marks]
In this part, you’re are asked to create a 2D 2-player tic toe game. Your main function will include a 3x3
2D char array initialized to empty spaces (‘ ‘).

1) Create a printer function that prints out the content of the array. Your output should look like
this.

2) After that take in x and y coordinates (starts from 0 till 2) and store the cross or knot in the
appropriate index of the array.

3) Keep switching between knots and cross as the game goes on.

You do not need to provide a check for whether a player wins the game and you can assume that user
inputs only the correct coordinates.

You might also like