Creating a Loop

I'm looking to create a loop that will have the play retype a variable if they type in the wrong one.

this is the current line om working on

cout << "\n\nWell then " << Playername << " today is your lucky day, you will be the first to attempt taming a familiar. Before we begin though I want to see what kidn of creatures you are able to summon.\n\n";
cout << "Everyone back off give us some space, Leofas come up to the center here. Now, try summoning a fire elemental\n\n.";

string SummoningSpells;

getline (cin, SummoningSpells);

if (SummoningSpells == "Come Forth Ifrit")
{
cout << "The sky darkens and the temperature rises, fire begins to draw runic symbols on the earth. The forest around you goes silent. A collum of fire burst from the earth and begins to dissipate.\n\n";
}
else
{
cout << "I asked you to summon a FIRE elemental! Try again.\n\n";
}
while SummoningSpells =

//this is the part where i would want to have the player retype the "Incantation"

system ("pause");
1
2
3
4
while(summoningSpell != /** desired choice **/)
   getline(cin, summoningSpell);

//Perform action for correct spell 
Last edited on
Say I want it to always display the error message if they player does not type the right spell, is there a way to do that without having to write the line of code for it over and over?
Topic archived. No new replies allowed.