Question: Readdat Program ReadData manipulates a two-dimensional table. #include #include #include using namespace std; const int ROW_MAX = 8; const int COL_MAX = 10; typedef int
Readdat
Program ReadData manipulates a two-dimensional table.
#include
const int ROW_MAX = 8; const int COL_MAX = 10;
typedef int ItemType; typedef ItemType Table[ROW_MAX][COL_MAX];
int main () { Table table; int rowsUsed; int colsUsed; ifstream dataIn; ofstream dataOut; int col; int row;
dataIn.open("debug.dat"); dataOut.open("debug.out"); dataIn >> colsUsed >> rowsUsed;
// Input table values. for (col = 0; col > table[row][col];
// Output table values. for (row = 0; row
return 0; }
C++
#include #include using namespace std; const int ROW_MAX = 8; const int COL_MAX = 10; typedef int ItemType; typedef ItemType ChartType[ROW_MAX][COL_MAX]; void GetChart(ifstream&, ChartType, int&, int&); // Reads values and stores them in the chart. int findLargest(ChartType, int, int); // to find the Largest value void PrintChart(ofstream&, const ChartType, int, int); // Writes values in the chart to a file. int main () { ChartType chart; int rowsUsed; int colsUsed; ifstream dataIn; ofstream dataOut; dataIn.open("chart2.dat"); dataOut.open("chart2.out"); GetChart(dataIn, chart, rowsUsed, colsUsed); PrintChart(dataOut, chart, rowsUsed, colsUsed); cout > rowsUsed >> colsUsed; for (int row = 0; row > item; chart[row][col] = item; } } //**************************************************** void PrintChart(ofstream& data, const ChartType chart,int rowsUsed, int colsUsed) // Pre: The chart contains valid data. // Post: Values in the chart have been sent to a file by row, // one row per line. { //to print chart by row for (int row=0; row

This lesson uses program charta. Progran chart2 manipulates atwo-dimonsional array variable #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
