I am using Microsoft Visual studio 2013
I currently have this switch statement:
switch (option)
{
case 1:
getline(cin, newname);
cout << "What would you like your new username to be?\nName: ";
getline(cin, newname);
name = newname;
cout << "\nYour username is now '" << name << "' with your balance being $" << balance << "\n";
options();
break;
case 2:
cout << "\nOpenning cheat menu\n";
cheats();
break;
default:
cout << "\nExitting to main title...\n";
title();
break;
}
you can just ignore the case 2 and default, just showing so you know that those cases work. Case 2 and default work perfectly fine but case 1 is acting weird. As you can see on case 1 I have two getline(cin, newname); You may think I should only have one, but for some reason I need two for this code to function correctly.
If I only have one of these the code jumps past the input the user should give. If I have two it works normally.
I have asked someone this and they do not understand either, so therefore: Why does this work.