Terugverwijzen

Status
Niet open voor verdere reacties.

TheJjokerR

Gebruiker
Lid geworden
25 apr 2008
Berichten
104
Hey,

Ik heb een script en ik wil dat het vanaf een bepaald punt terug verwezen word naar een eerdere regel:
Code:
 cout << "Options: \n 1. Start Game \n 2. Load Saved Game \n 3. Instructions \n 4. Quit Game \n" <<endl;
 string mmoption;
 getline(cin, mmoption);
  if (mmoption == "1")
   { system("cls"); cout << "An error occured: \nThis option is not yet available, you probably have the \nwrong version of TSFIGAD!"; }
  else if (mmoption == "2") 
   { system("cls"); cout << "An error occured: \nThis option is not yet available, you probably have the \nwrong version of TSFIGAD!"; }
  else if (mmoption == "3") 
   { system("cls"); cout << "Use the arrow keys to move up(^), left(<), right(>) and down(\\/). \nWhen you walk in the high grass monsters can appear, you will have to fight them to get to the other side of the field!\n-Good Luck!/*dus als ze hier(links) op enter drukken dat ik dit(rechts) niet helemaal opnieuw hoef te doen*/ \n\nOptions: \n 1. Start Game \n 2. Load Game \n 3. Instructions[This page]\n 4. Quit Game \n"; getline(cin, mmoption);}
  else if (mmoption == "4") 
   { exit(0); }

Bovenaan het script staat nog meer maar dat is niet belangrijk...
 
Ik heb een script en ik wil dat het vanaf een bepaald punt terug verwezen word naar een eerdere regel

Sorry ik dacht dat ik duidelijk was.

MIJN VRAAG:
Ik probeer vanaf
Code:
  else if (mmoption == "3") 
   { system("cls"); cout << "Use the arrow keys to move up(^), left(<), right(>) and down(\\/). \nWhen you walk in the...etcetc"//[COLOR="SandyBrown"][B]hier[/B][/COLOR]
terug te verwijzen naar het begin van mijn script hierboven.
Code:
/*hier>>*/ cout << "Options: \n 1. Start Game \n 2. Load Saved Game \n 3. Instructions \n 4. Quit Game \n" <<endl;
 string mmoption;
 getline(cin, mmoption);
  if (mmoption == "1")
   { system("cls"); cout << "An error occured: \nThis option is not yet available, you probably have the \nwrong version of TSFIGAD!"; }
  else if (mmoption == "2") 
   { system("cls"); cout << "An error occured: \nThis option is not yet available, you probably have the \nwrong version of TSFIGAD!"; }
  else if (mmoption == "3") 
   { system("cls"); cout << "Use the arrow keys to move up(^), left(<), right(>) and down(\\/). \nWhen you walk in the high grass monsters can appear, you will have to fight them to get to the other side of the field!\n-Good Luck!/*dus als ze hier(links) op enter drukken dat ik dit(rechts) niet helemaal opnieuw hoef te doen*/ \n\nOptions: \n 1. Start Game \n 2. Load Game \n 3. Instructions[This page]\n 4. Quit Game \n"; getline(cin, mmoption);}
  else if (mmoption == "4") 
   { exit(0); }

Ik hoop dat ik nu wel duidelijk ben..
:thumb:
 
Laatst bewerkt:
Dan kun je alles in een while lus stoppen waar hij pas uit komt als de gebruiker dat wilt ^^.

Code:
bool gebruikerWilStoppen = false;
while ( !gebruikerWilStoppen )
{
    PresenteerOpties();
    char keuze = VraagInput();
    gebruikerWilStoppen = VerwerkKeuze( keuze );
}

Hoop dat dit je op gang helpt ^^.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan