-2

I took a programming class and i'm having this problem. The problem is with the first case where. Tried to use string getline didn't work, later tried to use cin and didn't work. Can someone help me been stuck for 2 hours trying different soultions.

double time;
char answer='n';
while(answer=='n' || answer=='N')
{

setlocale(LC_ALL,"");
int stopp;

int choice;

string epost,name;

// Here is the menu
cout << "\n            Meny    ";
cout << "\n 1. Registration of new employee;
cout << "\n 2. Close the program \n";
cout << "choose: ";
cin >> choice;


switch (choice) 
{
case 1: 
    // First case 
        cout << "Skriv in förr och efternamn (ett mellan slag i mellan): ";
        getline(cin, name);

        cout << name << " is now registered";

        break;

case 2: 
        // Last case to close the program 
        svar='j';
        break;


}
}
return 0;
}

0 Answers0