Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <iostream> #include <fstream> #include <iomanip> using namespace std; i

ID: 3612993 • Letter: #

Question

#include <iostream>

#include <fstream>

#include <iomanip>

using namespace std;

int main()

{

double GPA;

char gender;

ifstream infile;

infile.open("h:\GPAData.txt");

if (!infile)

{

cout<< "Cannot open the inputfile."<<endl;

cout<< "Programterminates!!"<< endl;

return 1;

}

cout<<fixed<<showpoint<<setprecision(2);

infile>> gender>>GPA;

while (infile)

{

switch(gender)

{

case 'f':

avgFemaleGpa= GPA / (//I don't know what toput here- this is where I got stuck!!)

Explanation / Answer

//Hope this will help you. #include #include #include using namespace std; int main()                {                double GPA;                char gender;                double sum_F=0,count_F=0,sum_M=0,count_M=0;                ifstream infile;                infile.open("GPAData.txt");                if (!infile)                                {                                cout