I'm making a MUD.
Code:
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
char namen[100];
int initial;
cout<<"1.New game\n2.Load game\n3.Exit\n";
cin>>initial;
switch (initial){
case 1:
cout<<" Welcome to naushmien\n\n*Dramatic Music*\n\nPlease enter your name:";
cin.getline(namen,100,'\n');
cout<<namen<<" is it, alright then!";
break;
case 2:
cout<<"Not availiable yet.";
break;
case 3:
return 0;
break;
case 4:
cout<<"n/a";
break;
default:
cout<<"Unexpected error";
}
system("PAUSE");
return EXIT_SUCCESS;
}
Code:
case 1:
cout<<" Welcome to naushmien\n\n*Dramatic Music*\n\nPlease enter your name:";
cin.getline(namen,100,'\n');
cout<<namen<<" is it, alright then!";
break;
I can't get it to stop for the user to input their name. It skips directly to the end of the switch statment after it displays that. I still don't see how you can make the program interpret the saved game file.
In the "RPG" post I asked how you could make a shop keeper give a random response without having to generate random numbers. I don't have any clue how to make monsters encounters random.
Could you guys please clear some of this up for me?