Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions

Question

Strong analytical, communication, and problem-solving skills

Answered: 1 week ago