Hey guys. This is gettin annoying. ill post the stuff im struggling wid
#include <iostream.h>
#include <conio.h>
int main()
{
int input;
cout<<"1. Play game";
cout<<"2. Load game";
cout<<"3. Play multiplayer";
cout<<"4. Exit";
cin>>input;
switch (input)
{
case 1: playgame();
break;
case 2:
loadgame();
break;
case 3: //Note use of : not ;
playmultiplayer();
break;
case 4:
return 0;
default:
cout<<"Error, bad input, quitting";
}
return 0;
}
This program will not compile yet, but it serves as a model (albeit simple) for processing input.
If you do not understand this then try mentally putting in if statements for the case statements. Note that using return in the middle of main will automatically end the program. Default simply skips out of the switch case construction and allows the program to terminate naturally. If you do not like that, then you can make a loop around the whole thing to have it wait for valid input. I know that some functions were not prototyped. You could easily make a few small functions if you wish to test the code.
i dont understand hot to put a loop around it. also, do i have to include conio.h for all switch casing thankz cya