Question: #include #include using namespace std; ifstream inFile(values.txt); void read_marks(string *B00, int *c1, int *c2, int *c3, int n) { // opening the file with object

#include #include using namespace std;

ifstream inFile("values.txt");

void read_marks(string *B00, int *c1, int *c2, int *c3, int n) { // opening the file with object inFile for(int i=0; i> B00[i] >> c1[i] >> c2[i] >> c3[i]; cout

void compute_gpa(string *B00, int *c1, int *c2, int *c3, float *gpa, int n) { // variable to store average marks float avg_marks; for(int i=0; i= 90 && avg_marks = 85 && avg_marks = 80 && avg_marks = 77 && avg_marks = 73 && avg_marks = 70 && avg_marks = 65 && avg_marks = 60 && avg_marks = 55 && avg_marks = 50 && avg_marks

void write_marks(string *B00, int *c1, int *c2, int *c3, float *gpa, int n) { // opening or creating the file with object outFile ofstream outFile("output.txt"); outFile

int main() { // Reading Number of Students int n; inFile >> n;

// Declaring arrays string B00[n]; int c1[n], c2[n], c3[n]; float gpa[n];

// Calling Functions read_marks(B00, c1, c2, c3, n); compute_gpa(B00, c1, c2, c3, gpa, n); write_marks(B00, c1, c2, c3, gpa, n); }

The input file looks like this:

#include #include using namespace std; ifstream inFile("values.txt"); void read_marks(string *B00, int *c1,

Output file looks like this:

int *c2, int *c3, int n) { // opening the file with

Question:

object inFile for(int i=0; i> B00[i] >> c1[i] >> c2[i] >> c3[i];

10 B00999999 89 78 58 B00999998 72 45 86 B00999997 93 75 54 B00999996 63 74 73 B00999995 83 57 52 B00999994 74 85 76 B00999993 42 75 50 B00999992 74 59 65 B00999991 95 80 78 B00999990 94 90 98 number of students: 10 B00999999 89 78 58 3 B00999998 72 45 86 2.3 B00999997 93 75 54 3 B00999996 63 74 73 2.7 B00999995 83 57 52 2 B00999994 74 85 76 3.3 B00999993 42 75 50 1.7 B00999992 74 59 65 2.3 B00999991 95 80 78 3.7 B00999990 94 90 98 4.3 Modify the previous program so that vectors are used as the storage mechanism taking advan- tage of the vector class methods. The vectors must be allocated inside the functions read_values() and compute_gpa (). The program input/output remains unchanged

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!