here is an assignment due in a few days ive been trying my harderst to understand exactly what i need to do but im having a tough time could someone please help me begin this program, im really in a crunch right now.. any advice help problem sovling, all of it is greatly appreciated and welcome thank you very much..
Write a program to perform the following:
1. Open a file (input.dat) to read the elements of a 3 X 3 matrix and save them into a two-dimensional array,
2. Call a user-defined function to find the average of each row using pointer notations and print the result inside this function into another file (output.dat).
3. Call another user-defined function to print only the diagonal numbers and print the results on the monitor.
Maximum points will be given if you use pointer notation.
Input Matrix Average
1 4 7 = 4
2 5 8 = 5
3 0 4 = 2.33
The diagonal values are: 1 5 4
I would suggest making a Matrix class to store the matrices that you read in. Then write member functions in the class to solve problems 2 and 3.
The first thing you want to get working is being able to read correctly from the file into a Matrix object. I hope you know what the format of the file is, as that is necessary to get it to work. I assume it looks something like:
1 2 3
intintintintintintintintint
Write a function outside the class that takes a Matrix object as a parameter and read the values into the private attribute two-dimensional array as you read them from the file. Make a temporary input.dat to read in from. Since it is an assignment, I can't tell you exactly how to do that.
Use a different method to print out the values of the two dimensional array so you know you read in properly. From there you can start writing functions to perform 2 and 3.
This is just how I would go about solving it. Good luck!
thanks so much for all of you guys help its really appreciated I'm working on getting this program done its a bit tough I'm in my book 24/7.. again thanks if anyone has anymore help its VERY welcome