Here's my code:
Code:
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main(int argc,char *argv[])
{
char A,S,D,W,move,move2,name[20];
{
cout<<"SirCrono6 _ "<<endl;
cout<<" /I /"<<endl;
cout<<"A text- / / "<<endl;
cout<<"based /S / "<<endl;
cout<<"RPG / / "<<endl;
cout<<" /O/ "<<endl;
cout<<" /_/ "<<endl;
cout<<" "<<endl;
cout<<" "<<endl;
cout<<" Welcome to Iso."<<endl;
cout<<"It is a world of"<<endl;
cout<<"of Warriors, mages,"<<endl;
cout<<"and more. Enjoy"<<endl;
cout<<"your stay at Iso,"<<endl;
cout<<"for you may not"<<endl;
cout<<"return..."<<endl;
cout<<" "<<endl;
cout<<"What is your name? ";
cin.getline(name,20,'\n');
cout<<" "<<endl;
cout<<"Hello "<<name;
cout<<"! Welcome to Iso!"<<endl;
cout<<" Forward=W"<<endl;
cout<<" Left=A"<<endl;
cout<<" Right=D"<<endl;
cout<<" You see a guard infront of you. Back=S"<<endl;
cout<<"To your left, a castle. To your "<<endl;
cout<<"right, a gate. What will you do?"<<endl;
cin>>move;
}
if(move==A)
{
cout<<"The gate is locked, you turn back."<<endl;
}
else if(move==D)
{
cout<<"A town lies before you, the exit is"<<endl;
cout<<"infront of you. What will you do?"<<endl;
cin>>move2;
}
if(move2==S)
{
cout<<"There is no reason to go back now."<<endl;
}
else if(move2==W)
{
cout<<"You are at the gate, will you go out?"<<endl;
}
return 0;
}
I'm making a text-based RPG, I got out all the errors so far and stuff. You can put your name and enter it, but when you go to put L or R at the second input, it will close as soon as you push enter! I like RPGs and I want to program my own, but with this I can't really go on much...
Needing Help,
SirCrono6
Note: The messed up Iso title is because of the size of this window...