Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Key Learning Objectives: - Arrays & Vectors (2-dimensional) - Functions (pass by value vs pass by reference) - Looping - Branching - Print formatting -
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=2zm1={1,1,1,0},{1,0,,},{0,1,0,1}}d=3m1={,1,},{1,1,},{1,0,1}.d=2m1={{1,},{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) c. An explanation of reflexive, symmetric \& transitive can be found here: Matrix Relations.ppt \& Transitive closure is described here: Closure Video Bonus: 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). Practical solution: a. Be sure to comment code b. You must use functions (.h and .cppfiles) for the functions listed above Submission: - Complete THIS FORM for turn in. You will need to include: - Your pseudocode. This can be a link to a google document, an image, or a mire page. Make sure to share this with gladbachi@umkc.edu and - You will complete your code in Visual Studio. Please then copy your code to your repl.it space, ensure the program is running as expected, and supply the repl.it link in this form - Screen shots of the 3 matrix examples that are given below is required unless you have added file input as part of your program. Please put all three in the same google document file \& make sure to share this with, and stgdcg@umsystem.edu. Enter the type of input to use: 0 - File 1 - Use set values: Enter your choice: 1 Which vector dimension (2-4) do you prefer? 4 The current matrix is: The matrix is not reflexive The matrix is symmetric The matrix is not transtive The result of the matrix to the power of 2 is: The result of the matrix to the power of 3 is: F Bonus Example (Route Checking) Jould you like to check routes? ( Y if so): Y Great! Enter values between 0 and 3: Enter the starting value: 2 Enter the ending value: 0 There is not a path between 2 and 0 ! Would you like to try again (Y) : Y Great! Enter values between 0 and 3: Enter the starting value: 2 Enter the ending value: 2 There is a path between 2 and 2
Step 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