Why does this loop execute infintely
#include <iostream> // #include <algorithm> #include <cstring> #include <string_view> #include <stdio.h> using namespace std; int main() { char selection; // grade entered by user cout << " Enter selection" << endl; selection = std::getchar(); while ((selection != 'X')){ switch ( selection ) // switch statement nested in while { case 'A':case 'a':// grade was uppercase A cout<< "Ok" <<endl; break; case 'B': case 'b': cout<< "Ok" <<endl; break; case 'C':case 'c': cout<< "ok" <<endl; break; // exit switch case 'D':case 'd': // grade was uppercase D // or lowercase d cout<< "bad" <<endl; break; // exit switch case 'F': case 'f':// grade was uppercase F // or lowercase f cout<< "bad" <<endl; break; // exit switch default: cout << " Exit the program" << endl; } } return 0; }