I've got a problem. I've got 2 functions Both calling upon each other at specific times but the First function can't use the 2nd function because it hasn't been declared... is there a way around this?
cout << "Welcome to TextScape General Store!.\n\n";
cout << "Would you like Health Upgrade, Armour, wepons or to heal?\n";
cout << "Armour = 1\n";
cout << "Weapon = 2\n";
cout << "Health Upgrade = 3\n";
cout << "Heal = 4\n";
cout << "Return = 5\n";
cin >> Select;
if(Select == 1)
{
int Buy;
cout << " What armour would you like?\n";
cout << "1: Bronze = +5 Defence, 10 Gold\n";
cout << "2: Iron = +10 Defence, 30 Gold\n";
cout << "3: Steel = +20 Defence, 60 Gold\n";
cout << "4: Mithril = +40 Defence, 300Gold\n";
cout << "5: Return";
cin >> Buy;
if (Buy == 1)
{
if ((PLG > 10 )&( BA == 1))
{
cout << "You've a Bronze armour set and gained 5 Defence.\n";
PLG -= 10;
PLD += 10;
BA = 0;
}
else
{
cout << "You've Either already got a Set of this armour or don't have enough money to buy This item.\n";
Shop ();
}
}
if (Buy == 2)
{
if((PLG > 30 )&( IA == 1))
{
cout << "You've bought a Iron armour set and gained 10 defence.\n";
PLG -= 30;
PLD += 10;
IA = 0;
}
else
{
cout << "You've either already got a set of this armour or don't have enough money to buy this item.\n";
Shop ();
}
}
if (Buy == 3)
{
if((PLG > 60) & (SA == 1))
{
cout << "You've bought a Steel armour set and gained 20 defence.\n";
PLG -= 60;
PLD += 20;
IA = 0;
}
else
{
cout << "You've either already bought a set of this armour or you don't have enough money to buy this item.\n";
Shop ();
}
}
if (Buy == 4)
{
if((PLG > 300) & (AA == 1))
{
cout << "You've bought a adimantium armour set and have gained 40 defence.\n";
PLG -= 300;
PLD += 40;
AA = 0;
}
else
{
cout << "You've either already bought a set of this armour or don't have enought money to buy this item.\n";
Shop ();
}
}
if (Buy == 5)
{
Shop ();
}
}
if (Select == 2)
{
int Buy;
cout << " What weapon would you like?\n";
cout << "1: Bronze = +5 Attack, 10 Gold\n";
cout << "2: Iron = +10 Attack, 30 Gold\n";
cout << "3: Steel = +20 Attack, 60 Gold\n";
cout << "4: Mithril = +40 Attack, 300Gold\n";
cout << "5: Return";
cin >> Buy;
if(Buy == 1)
{
if((PLG > 10) & (BS == 1))
{
cout << "You've bought a Bronze sword and gained 5 attack.\n";
PLG -= 10;
PLA += 5;
BS = 0;
}
else
{
cout << "You've either already bought this sword or don't have enough money to buy this item.\n";
Shop ();
}
}
if(Buy == 2)
{
if((PLG > 30) & (IS == 1))
{
cout << "You've bought a iron sword and gained 10 attack.\n";
PLG -= 30;
PLA += 10;
IS = 0;
}
else
{
cout << "You've either already bought this sword or don't have enought money to buy this item.\n";
Shop ();
}
}
if(Buy == 3)
{
if((PLG > 60) & (SS == 1))
{
cout << "You've bought a Steel sword and gained 20 attack.\n";
PLG -= 60;
PLA += 20;
SS = 0;
}
else
{
cout << "You've either already bought this sword or don't have enought money to buy this item.\n";
Shop ();
}
}
if(Buy == 4)
{
if((PLG > 300) & (AS == 1))
{
cout << " You've bought Adimantium sword and gained 40 attack.\n";
PLG -= 300;
PLA += 40;
AS = 0;
}
else
{
cout << " You've either already bought this Sword or you don't have enought money to buy this item.\n";
Shop ();
}
}
if (Buy == 5 )
{
Shop ();
}
if(Select == 3)
{
int Select;
int Buy;
cout << "Would you like to upgrade your Health for a price of 10G per HP point.\n";
cout << "How many Health point would you like to buy?\n 0 to Go back.\n";
cin >> Select;
if (Select == 0 )
{
Shop();
}
else
{
Select = Buy;
if(Buy < PLG)
{
PLQ += Buy;
PLG -= Buy;
}
else
{
cout << "You don't have enought Gold to buy this many HP.\n";
Shop ();
}
}
}
if(Select == 4)
{
int Buy;
int Max;
Max = PLQ - PLH;
cout << "To heal it costs 1 Gold per HP healed.\n";
cout << "To return enter 0.\n";
cout << "You can heal a maximume of " << Max << " HP.\n";
cin >> Buy;
if( Buy < PLG )
{
if(Buy < Max)
{
PLH += Buy;
PLG -= Buy;
cout << "You've healed " << Buy << "Hps.\n";
}
}
}
if (Select == 5)
{ Choice ();
}
}
}
void Choice ()
{
cout << " What would you like to do now?\n";
cout << "1 = Attack : Fight a random moster in a Kill or be killed situation.\n";
cout << "2 = Shop : Visit a Show to upgrade or heal.\n";
cout << "3 = States : Check current Chariter status.\n";
cin >> Command;
if(Command == 1) // Battle
{
int FleC;
Level ();
RanM();
cout << "You are fighting a LvL " << MOL << " " << MON << ".\n" ;
cout << "Attack or Flee? There's a 20% change of a seccessful Flee.\n";
cout << "Attack = 1, Flee = 0\n";
cin >> BattleC;
if (BattleC == 1)
{
Attack ();
MonsterAttack ();
MOH = MOH - DMG;
cout << "You attack the " << MON << " and deal " << DMG << " damage.\n";
cout << "The " << MON << " Attacks you and deals " << MDM << "damage.\n";
if(MOH > 0)
{
cout << "What would you like to do now?\n 1 = Attack 0 = Flee.\n";
cin >> BattleC;
}
else
{
cout << "You've Killed the " << MON << " and have gained " << MOE << "EXP and " << MOG << "Gold.\n";
PLG += MOG;
Level ();
Choice ();
}
}
if (BattleC == 0)
{
FleC = (rand()%5)+1;
if(FleC == 2)
{
cout << "You've secceeded in Fleeing";
Choice ();
}
else
{
"Your Atempt to Flee has Failed and you encounted in battle again.";
}
}
if(Command == 2) // Shop
{ Shop();
}
if(Command == 3) // Stats
{
cout << "\n\n Your stats are:\n";
cout << "Level = " << LVL << ".\n";
cout << "Health = " << PLQ << ".\n";
cout << "Current HP = " << PLH << ".\n";
cout << "Armour = " << PLD << ".\n";
cout << "Attack = " << PLA << ".\n";
cout << "EXP = " << EXP << ".\n";
cout << "EXP till next level = " << NLV << ".\n\n";
Choice ();
Level ();
}
}
}
Edit:: um my email is jamort@netzero.com if you want to send me the cpp file and i can tell you what needs fixing a lot more accurately
I'm going to pm you (i guess they have it on here), so you can send me the actual cpp file, and all a header does essectially is copy and pastes the code in the c++ file to compile