Dec 21, 2011 at 3:02pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
int char_create()
{
cout << "Hello! What's your name?" << endl;
cout << ">" ;
getline(cin, username);
cout << "Hello " << username << endl;
cout << "What class are you?" << endl;
cout << "1: Warrior (High attack and defense)" << endl;
cout << "2: Archer (Well rounded)" << endl;
cout << "3: Mage (High crafting and intelligence)" << endl;
cin >> input_int;
switch (input_int)
case 1:
userclass = "Warrior" ;
case 2:
userclass = "Archer" ;
case 3:
userclass = "Mage" ;
ofstream character_data((username + ".txt" ).c_str());
character_data << username << endl;
character_data << userclass << endl;
return 0;
}
This function is giving me an illegal use of case for cases 2 and 3?
Sorry for all my questions I am still getting used to Visual Studio 2010. Big jump from Dev-C++. There will probably be a few more questions so I am going to just keep this post open for them.
Last edited on Dec 21, 2011 at 3:02pm UTC
Dec 21, 2011 at 3:15pm UTC
Thank you I can't believe I forgot that XD
Dec 21, 2011 at 3:21pm UTC
And may be use break ... in your switch case.
Dec 21, 2011 at 3:33pm UTC
Already on that. Added it after I posted this lol.