Question: //Problem statement: This is a review for COSC1436, CS 1410, we use a multidimensional array to save grades for students (grade.txt), and a one //dimension

//Problem statement: This is a review for COSC1436, CS 1410, we use a multidimensional array to save grades for students (grade.txt), and a one //dimension array of type string to save student''s f and last name. // we use functions to read data, and store them to those two arrays. // we use a function to find sum of grades for each students and save it a one dimensional array of type integer //we write a function to find average of grades for each students and save it a one dimensional array of type double //we write a function to find letter grade for each student and save it a one dimensional array of type character //We write a function to display all datas as follow

// Student's name Grades Total Average Letter grade // Marisa Tobbi 100 600 100 A ... ... . ... .... ...

... .. . ... .. ... //Preprocessor directive //global variables //function prototypes //main program //functions definitions #include // Preprocessors directive #include // to read and write from a file #include // String preprocessor to read string of characters #include // to be able to have proper spacing and precisions for numbers using namespace std; const int row = 5; // Global Variable const int col = 6; ifstream inputname, inputgrade; ofstream output; //Functions prototype void readdata(string stname[row], int stgrade[row][col]); void sum(int stgrade[row][col], int totalg[row]); void average(int totalg[row], double staverage[row]); void lettergrade(double staverage[row], char stletter[row]); void display(string stname[row], int stgrade[row][col], int totalg[row], double staverage[row], char stletter[row]); int main() { string n[row] = {}; //Declare and initialize argument n for name int g[row][col] ={{0},{0}}; int s[row] = {}; readdata(n, g); //Arguments n for name and g for grade sum(g, s); inputname.close(); inputgrade.close(); return 0; } //=========================== Read Function ============================== void readdata(string stname[row], int stgrade[row][col]) { inputname.open("name.txt"); inputgrade.open("grade.txt"); for (int r = 0; r < row; r++) //Read names form file getline(inputname, stname[r]); for (int r = 0; r < row; r++) // Read each roo grades from file for(int c= 0; c< col; c++) // Read each coloumn inputgrade >>stgrade[r][c]; } //================================= Calculate sum =========== void sum(int stgrade[row][col], int totalg[row]) { } //================================= Calculate average =========== //================================= Calculate letter grade =========== //================================= display result ===========

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!