Hola,
Estba haciendo una aventura de texto, ya sabeis tpo ZORK:THE UNDERGORUND EMPIRE.
Entonces lo que quiero es esto.
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
string elec;
system("title Lost!-PandoraX");
cout<<"Welcome to Lost!!";
cout<<"\n";
cout<<"This is a text game adventure!"<<endl;
cout<<"Created by Samuel Dominguez(PandoraX)";
cout<<"\nPandoraX!";
cout<<"\n\n";
cout<<"You are on the first floor of a white house\nand you are sitting on a chair,\nthere is a key in front of you"<<endl;
cout<<">";
cin>>elec;
if (elec=="take key")
{
cout<<"Now, the key is on your pocket."<<endl;
cout<<"What now?"<<endl;
cout<<">";
cin>>elec;
}
else
{
cout<<"I don't know what does '"<<elec;
cout<<"' mean"<<endl;
cout<<">";
cin>>elec;
}
return EXIT_SUCCESS;
}
Lo que quiero es que cuando el jugador escriba algo que no sea 'take key' (coger llave", que le mande un mensaje diciendo que no sabe lo que a metido (eso ya esta hecho), y que vuelva a el if del principio. Se puede hacer con goto? Si, pero ya sabeis lo malo que es goto, es un mal habito programar con el a si que como lo hago?¿
Salu2!
Ah, y Feliz Navidad a todos!
Podes meterlo en un bucle facilmente (for, while, etc.) y con un comando hacerlo termianr (quit, exit, etc.).