I am having trouble with this one. Whenever I run it I enter in the grade value and it starts repeating over and over really fast. What is wrong with it?

# include <iostream>
using namespace std;

int main ()
{
    cout << "welcome to my GPA calculator\n" << endl;
    float GPA, totalClasses, totalGPA;
    int x;
    totalGPA = 0.000;
    totalClasses = 6.000;
    char choice = 'Y';
    float grade;
    
    while (choice == 'y' || choice == 'Y')
    {
          cout << "enter in your letter grade" << endl;
          cin >> grade;
          
          if (grade == 'a' || grade == 'A')
          {
          totalGPA = totalGPA + 4.000;
          }
          else
          {
              if (grade == 'b' || grade == 'B')
              {
              totalGPA = totalGPA + 3.000;
              }
              else
              {
                  if (grade == 'c' || grade == 'C')
                  {
                  totalGPA = totalGPA + 2.000;
                  }
                  else
                  {
                      if (grade == 'd' || grade == 'D')
                      {
                      totalGPA = totalGPA + 1.000;
                      }
                      else
                      {
                          if (grade == 'f' || grade == 'F')
                          {
                          totalGPA = totalGPA + 0.000;
                          }
                      }
                  }
              }
          }
          
          GPA = totalGPA / totalClasses;
          cout << "do you want to continue? (Y/N)" << endl;
          cin >> choice;
          cin >> x;
    }
          GPA = totalGPA / totalClasses;
          cout << "your GPA is: " << GPA << endl;
          cout << "press x to exit" << endl;
          cin >> x;
          return 0;
          

}
This article has been dead for over six months. Start a new discussion instead.