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. .
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
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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F3f6c81c7-9a41-4014-8916-60df888d5014%2Fe68e76de-12ea-4fc1-aee9-892aee4b9b27%2Frrgbl25_processed.jpeg&w=3840&q=75)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 5 images

Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education