#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) { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.