This is the most progress I've made on my RPG since I've started:
Surprisingly I fixed a lot of the errors myselfCode:#include <cstdlib> #include <iostream> #include <ctime> using namespace std; void r1() //first territory { cout<<"You can move south or east. type h for help."; } int main(int argc, char *argv[]) { char namen[100]; int initial; int strength; int agility; int defense; char command; char west, east, north, south; cout<<"What would you like to do?"; cout<<"\n1.New game\n2.Load game\n3.Exit\n"; //Menu cin>>initial; switch(initial){ //menu switch statment case 1: cout<<"Enter your name:"; //ask for name cin>>namen; cout<<namen<<" is it. Alright then\n"; cout<<"Enter your strength agility and defense again(must=20):\n"; cin>>strength>>agility>>defense; while(strength+agility+defense!=20){ //loop if str ag and def not 20 cout<<"Enter strength, agility, and defense(must=20):"; cin>>strength>>agility>>defense; } break; case 2: //loading game cout<<"Not availiable yet"; system("PAUSE"); break; case 3: //exit return 0; break; default: cout<<"error"; //default system("PAUSE"); } //intro cout<<" Welcome to naushmien\n\n*Dramatic Music*\n\n"; r1(); for(int loop=0;loop<100;loop++){ cin>>command; switch(command){ case 'a': return 0; break; default: cout<<"messed"; break; } system("PAUSE"); return EXIT_SUCCESS; }![]()
![]()
The one I don't know how to fix is error at end of input. At first I thought it was because I had a never ending while loop.
I was just trying to make some progress can you put a switch statment in a loop?
I'm pretty proud of myself.



LinkBack URL
About LinkBacks



