Answered step by step
Verified Expert Solution
Question
1 Approved Answer
My Code up to this point: I'm having trouble understanding how to read info from a file into a function and then input it into
My Code up to this point:
I'm having trouble understanding how to read info from a file into a function and then input it into an array to use. I have comments that are roughly my thought process but i think im just unfamiliar/ unpracticed with the tools one would use to solve a problem like this. any additional insight into the best way to do this using the given tools would be greatly appreciated.
For this assignment, you will write a C++ program that will read in a two dimensional array from a file after prompting for the file from the user. The first two values in the file are the dimensions of the array. The dimensions will NOT exceed a 20 by 202d array and are guaranteed to be at least 0 by 0 . The rest of the values will be integers delimited by white space. Determine the largest and smallest values in the file. Program Requirements 1. Follow the style guide. 2. Use global constants for the maximum dimensions of the array 3. Use a void function called FillArray that accepts four arguments (an input file object, a two dimensional array, the actual row size, and the actual column size). This function should read through the file and fill the array. The file object, row size, and column size should be defined as reference parameters. 4. Use a value returning function called FindMax that accepts three arguments: the 2d array as a constant parameter, the row size, and the column size. It should return the largest value in the array. 5. Use a value returning function called FindMin that accepts three arguments: the 2d array as a constant parameter, the row size, and the column size. It should return the smallest value in the array. Sample Runs 1. Sample Run 1 (invalid file) Enter filename to process: nofile.dat nofile.dat not found! 2. Sample Run 2 (dataone.dat) Enter filename to process: dataone. dat Min value: 4 Max value: 7 3. Sample Run 3 (datatwo.dat) Enter filename to process: datatwo.dat Min value: 99 Max value: 100 4. Sample Run 4 (datathree.dat) Enter filename to process: datathree.dat Min value: 0 Max value: 0Step 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