Class Choosing Screen (Multiple Things)
Firstly, I'm new to C++ so don't pick on me. Thank you.
I'm making a text-based-adventure game (original, right?) and I need some help on a few things
Case Not Working
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
int classSelection()
{
char classChosen;
cout << "Please choose your class" << endl;
cout << "Press 1 for warrior or 2 for mage: ";
cin >> classChosen;
switch (classChosen) {
case 1:
system("CLS");
warriorTown();
break;
case 2:
system("CLS");
mageTown();
break;
default:
system("CLS");
cout << "Error, now exiting.";
}
}
| |
So when I compile this, I enter in 1 or 2 and I get
Error, now exiting.
Process returned 0 (0x0) execution time : 2.498 s
Press any key to continue. |
system("CLS")
What can I use to replace system("CLS")? It seems I shouldn't be using it.
Ok sorry this is a mess, hopefully you can understand and help me. Thanks
- Scelton
When you get '1' into a character, it stays as '1' (different from 1, the number).
As for system, just don't clear the screen. I don't really see why you need to do that anyway.
Why am I such an idiot, I hadn't realised that I'd put char instead of int. Thanks :)
As for the clear screen, the command prompt get's rather messy after a little while. It would be nice to have a screen wipe.
Topic archived. No new replies allowed.