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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started