Question: Data Structures and Algorithms Programming Assignment: Change this Program to have Two Functions ( Read and Display ) Create sets of name and grade as

Data Structures and Algorithms Programming Assignment:

Change this Program to have

Two Functions (Read and Display)

Create sets of name and grade as two separate input (text) files

Then convert the program to structure with having two members Name and grades

Then pass structure variable to the functions and input data two a proper member variable.

#include #include #include #include

using namespace std;

const int row = 6; const int col = 7;

ifstream inn, ing; // inn is object for input name, ing is object for grades

int main() { int r, c; //loop control variable string name[row] = {}; //this array stors names int grades[row][col] = { {0},{0} }; //This array stors grade

inn.open("mynames.txt"); //open file for names ing.open("mygrads.txt"); //open file for grades

for (r = 0; r < row; r++) //Reading names { getline(inn, name[r]); for (c = 0; c < col; c++) // Reading grades ing >> grades[r][c]; //grades[0][0] }

for (r = 0; r < row; r++) { cout <

inn.close(); ing.close();

return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!