Answered step by step
Verified Expert Solution
Link Copied!

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++ image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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 above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Joe Celkos Data And Databases Concepts In Practice

Authors: Joe Celko

1st Edition

1558604324, 978-1558604322

More Books

Students also viewed these Databases questions

Question

Explain the chemical properties of acids with examples.

Answered: 1 week ago

Question

Write the properties of Group theory.

Answered: 1 week ago