i=0;
while(i<=20)
{
nullchoice:
system("CLS");
//Advanced Information
cout << "Your Statistics: " << endl;
cout << endl << endl;
cout << " 1 Strength: " << str << endl;
cout << endl;
cout << " 2 Vitality: " << vit << endl;
cout << endl;
cout << " 3 Agility: " << agi << endl;
cout << endl;
cout << " 4 Thaumaturgy: " << tha << endl;
cout << endl << endl;
cout << "Points Remaining: " << lvlskills << endl;
cout << endl;
cout << "Enter the number of the skill you wish to increase: ";
//Applying points to skill attributes
if(i<=19)
{
cin >> input;
if(input==1)
str+=1;
else if(input==2)
vit+=1;
else if(input==3)
agi+=1;
else if(input==4)
tha+=1;
else
goto nullchoice;
lvlskills-=1;
}
i++;
cout << endl << endl;
}
So essentially, I am creating a game in C++, a text-based RPG. It's fairly basic, with stats (Strength, Vitality, etc.) you might expect from such a game. In the beginning, as shown here, the player is allowed to distribute some points to skills they choose.
Here's where the problem arises. Right now, the player must enter a number (1, 2, 3, or 4. If it's none of these numbers it will goto the nullchoice), then press ENTER. It's unwieldy and just plain wrong to have the player do this, so is there any simple way that I can code it so they only have to press the number?
I'd imagine I would use this very much throughout the rest of my game. Thanks for reading!