I have this program that gets the choice of the user. After that, the user needs to enter his name. I tried using cin>>nameInput because I'm just entering one name. But I wanted to enter a full name so I changed it to getline(cin,nameInput); and now the program skips the first prompt.
Here is the part of the code:
void menu(){
    char choice;
    string nameInput,inTime,outTime;
    while(true){
        cout << "======================\n";
        cout << "|   [1] Log in       |\n";
        cout << "|   [2] Log out      |\n";
        cout << "|   [3] View Records |\n";
        cout << "|   [0] Exit         |\n";
        cout << "|____________________|\n";
        cout << "Choice: ";
        cin >> choice;
        cin.clear();
        cout << endl;
        switch(choice){
            case '1':
                cout << "Enter name: ";
                cin >> nameInput;
                cout << "Time in: ";
                cin >> inTime;
                in(nameInput,inTime);
                system("cls");
                break;
I have tried using cin.clear(), but it still won't work.
 
    