Gives me the following results if I enter 100 for a single grade.Code://Average scores else if ((Menu == 'B') || (Menu == 'b')){ char AvgDone; double TotalGrade; double Grade; double AvgGrade; double NumOfGrades = 0; do{ cout << "Please enter your grade" << endl; cin >> Grade; TotalGrade = TotalGrade + Grade; NumOfGrades = NumOfGrades + 1; cout << "Do you have more grades to enter? [Y]es or [N]o " << endl; cin >> AvgDone; } while((AvgDone == 'Y') || (AvgDone == 'y')); AvgGrade = TotalGrade / NumOfGrades; cout << "The average for the " << NumOfGrades << " grades given is " << AvgGrade << endl; cout << "Return to the menu? [Y]es or [N]o" << endl; cin >> Again;
It seems to me this is simply 100 / 1 and therefore should be 100, or is this working with some 'new' math??Code:************************************************************ * Plese choose from the following menu options * * <A> Convert single numeric grade to alpha grade * * * * <B> Average numeric grades * * * * <C> End Program * ************************************************************ Enter your choice b Enter your numeric grade: Please enter your grade 100 Do you have more grades to enter? [Y]es or [N]o n The average for the 1 grades given is -9.25596e+061 Return to the menu? [Y]es or [N]o
Thanks!!
By the way, yes, this is homework!![]()



LinkBack URL
About LinkBacks



