4 Two-Dimensional Arrays Use program Chart for Exercises 5-6, // Program Chart manipulates a two-dimensional array variable. #include #include using namespace std; const int ROW MAX = 8; const int COL MAX = 10; typedef int ChartType [ROW MAX] [COL MAX]; void GetChart (ifstreams, ChartType, intá, intá); // Reads values and stores them in the chart. void PrintChart( const ChartType, int, int); // Prints values in the chart to the screen. int main 0 ChartType chart; int rowsUsed; int colsUsed; ifstream dataIn; dataIn.open ("Chart.dat"); GetChart (dataIn, chart, rowsUsed, colsUsed); PrintChart (chart, rowsUsed, colsUsed); return 0; void GetChart(ifstream& data, ChartType chart, intá rowsUsed, intá colsUsed) // Pre: rowsUsed and colsUsed are on the first line of // file data; values are one row per line // beginning with the second line. // Post: Values have been read and stored in the chart. data >> rowsUsed >> colsUsed; for (int row - 0; row < rowsUsed; row++) for (int col = 0; col < colsUsed; col++) // FILL IN code to read and store the next value void PrintChart( const ChartType chart, int rowsUsed, int colsUsed) // Pre: The chart contains valid data. // Post: Values in the chart have been printed on the screen // one row per line. // FILL IN code to print chart by row for (int row = 0; row < rowsUsed; row++) for (int col // FILL IN = n. < colsUsed; col++) int the next value } Exercise 5: Read the documentation carefully and complete program Chart. Enter the following data in the file Chart.dat. 45 31415 23671 7 8888 9 8765 Show what is printed. Exercise 6: Add a function that prints the largest value in array variable chart. Rerun the program and show the result. .

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Can anyone help me with this question
4 Two-Dimensional Arrays
Use program Chart for Exercises 5-6,
// Program Chart manipulates a two-dimensional array variable.
#include <iostream>
#include <fstream>
using namespace std;
const int ROW MAX = 8;
const int COL_MAX = 10;
typedef int ChartType [ROW MAX] [COL MAX];
void GetChart(ifstream&, ChartType, intá, int&);
// Reads values and stores them in the chart.
void PrintChart ( const ChartType, int, int);
// Prints values in the chart to the screen.
int main ()
ChartType chart;
int rowsUsed;
int colsUsed;
ifstream dataIn;
dataIn.open ("Chart.dat");
GetChart (dataIn, chart, rowsUsed, colsUsed);
PrintChart (chart, rowsUsed, colsUsed);
return 0;
//**
void GetChart(ifstream& data, ChartType chart,
int& rowsUsed, int& colsUsed)
// Pre: rowsUsed and colsUsed are on the first line of
// file data; values are one row per line
// beginning with the second line.
// Post: Values have been read and stored in the chart.
data >> rowsUsed >> colsUsed;
for (int row - 0; row < rowsUsed; row++)
for (int col = 0; col < colsUsed; col++)
// FILL IN code to read and store the next value
void PrintChart( const ChartType chart,
int rowsUsed, int colsUsed)
// Pre: The chart contains valid data.
// Post: Values in the chart have been printed on the screen
// one row per line.
// FILL IN code to print chart by row
for (int row = 0; row < rowsUsed; row++)
{
< colsUsed; col++)
for (int col = n.
// FILL IN
int the next value
Exercise 5:
Read the documentation carefully and complete program Chart. Enter the following data in the file
Chart.dat.
45
31415
23671
7888 8
9 8765
Show what is printed.
Exercise 6:
Add a function that prints the largest value in array variable chart. Rerun the program and show the
result.
Transcribed Image Text:4 Two-Dimensional Arrays Use program Chart for Exercises 5-6, // Program Chart manipulates a two-dimensional array variable. #include <iostream> #include <fstream> using namespace std; const int ROW MAX = 8; const int COL_MAX = 10; typedef int ChartType [ROW MAX] [COL MAX]; void GetChart(ifstream&, ChartType, intá, int&); // Reads values and stores them in the chart. void PrintChart ( const ChartType, int, int); // Prints values in the chart to the screen. int main () ChartType chart; int rowsUsed; int colsUsed; ifstream dataIn; dataIn.open ("Chart.dat"); GetChart (dataIn, chart, rowsUsed, colsUsed); PrintChart (chart, rowsUsed, colsUsed); return 0; //** void GetChart(ifstream& data, ChartType chart, int& rowsUsed, int& colsUsed) // Pre: rowsUsed and colsUsed are on the first line of // file data; values are one row per line // beginning with the second line. // Post: Values have been read and stored in the chart. data >> rowsUsed >> colsUsed; for (int row - 0; row < rowsUsed; row++) for (int col = 0; col < colsUsed; col++) // FILL IN code to read and store the next value void PrintChart( const ChartType chart, int rowsUsed, int colsUsed) // Pre: The chart contains valid data. // Post: Values in the chart have been printed on the screen // one row per line. // FILL IN code to print chart by row for (int row = 0; row < rowsUsed; row++) { < colsUsed; col++) for (int col = n. // FILL IN int the next value Exercise 5: Read the documentation carefully and complete program Chart. Enter the following data in the file Chart.dat. 45 31415 23671 7888 8 9 8765 Show what is printed. Exercise 6: Add a function that prints the largest value in array variable chart. Rerun the program and show the result.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education