Hi guys, my teacher assigned a basic degree planner, I already coded most of it but for some reason I cannot seem to get the Boolean function to work correctly keeps returning true. Maybe a fresh set of eyes can spot what i am doing wrong. Any help is welcomed.
std::cout << "\nEnter you grade for the class... \n A for 90% - 100%\n B for 80% - 89%\n C for 70% - 79%\n D for 60% - 69%\n F for 59% or less.\n\n";
std::cin >> classGrade;
return enterGrade(); //Recursive function :) My first time using it.
float getGPA(int score, int classes_taken)
return (score / (classes_taken * 3));
bool eligibletograd(int GPA)
return (GPA < 2.0);
std::cout << "Welcome to my Degree Planner. First, please enter how many classes you need to graduate.\n\n";
std::cin >> num_classes;
for(int i = 0; i < num_classes; i++)
score += enterGrade();
std::cout << "Total classes taken: "<< num_classes << "\n\n";
std::cout << "Total points accumulated: " << score << "\n\n";
std::cout << "GPA: " << getGPA(score, num_classes) << "\n\n";
std::cout << "You graduated!\n\n";
std::cout << "You didn't graduate.\n\n";
There may be an added feature that you want to put in, but that is easy. Lots of global variables != encapsulation.
You were overwriting the variables before the data needed in them was able to be used in another function. Also, a for loop is really what you need. ;)