Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write Code in C++ Key Learning Objectives: - Arrays & Vectors (2-dimensional) - Functions (pass by value vs pass by reference) - Looping - Branching
Write Code in C++
Key Learning Objectives: - Arrays \& Vectors (2-dimensional) - Functions (pass by value vs pass by reference) - Looping - Branching - Print formatting - Bonus: file input Assignment Problem: You will be creating a series of functions to complete this project. Below is the list of functions that you should create for full credit: a. Create a function to initialize the matrix (sample matrix data is listed below) d=4;m1={{1,1,1,0},{1,1,0,1},{1,,0,0},{0,1,0,1}}; d=3;m1={1,1,0},{0,1,0},{1,0,1}};d=2;m1={{1,0},{0,1}}; b. Allow the user to pick which of the 3 dimensions they prefer and use that matrix to see if it is reflexive, symmetric, transitive, and to find the transitive closure. To do this, create the functions: - Create a function to print the matrix given Create a function to add two matrices together (you will be using the same matrix 2 times) - Create a function to square the matrix given - Create a function to check if the matrix is reflexive (if all values on the diagonal are 1) - Create a function to check if the matrix is symmetric (values are equal across the diagonal) - Create a function to check if the matrix is transitive (not transitive if there is a non-zero in the squared matrix that is zero in the original matrix) - Create a function to find the transitive closure of the matrix (continue to multiply the matrix by itself up to the number of dimensions and keep a running total of the sum of all of these matrices) a. Create a function read an input file (see data.txt for input example). Add the code to read the matrix size \& load the elements of a matrix (in row-major order) from a file, reading \& processing multiple matrices and outputting the results b. Prompt to see if user would like to verify a path. If so, allow user to enter a starting value and ending value to determine if a path exists from the starting point to the ending point (if the coordinate point in the transitive closer is non-zero, there is a path from i to j (i,j). a. Be sure to comment code b. You must use functions (.h and .cpp files) for the functions listed aboveStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started