Question: Direction: Create class having separate executable file, header file and implementation file. Write class with appropriate constructors to initialize the values of member variables. Problem
Direction: Create class having separate executable file, header file and implementation file.
Write class with appropriate constructors to initialize the values of member variables.
Problem 1: Write a C++ program to define a class having a 4x4 matrix. Generate 32 random
numbers 1-10, in an output.txt file. Fill the generated numbers in two such class objects (first 16
numbers in one matrix and next 16 numbers in another. Create member functions each for
adding, subtracting and multiplication of matrices. Write the algorithm defining steps of your
program. (Mark 10)
Problem 2: Write a C++ program and algorithm to create a class of fraction having variables
numerator and denominator, and member functions setting and getting values of the fractions.
Also create a static member variable of the class having fraction value tolerance of 0.1.
Instantiate 10 fraction objects and find out how many of them are below and above tolerance
level. Decrement the tolerance to 0.01 by a static member function and find out how many of
them are now above and below the new tolerance level. (Marks 10)
Problem 3: Write a C++ program for tic tac toe board game of 3x3 matrix. Create a class having
member functions and variable of the board size char board[3][3]. Write the algorithm defining
steps of your program. (Marks 10)
Problem 4: Write a C++ program and algorithm having two classes for determining a dot product
and cross product of two vectors. Also find the angle between the vectors. Each vector size is 3D
(x, y and z coordinates). Write algorithm of your program. (Marks 10)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
