Another problem, I am trying to test to see if the player has enough gold to purchase items from the store before purchasing them, however it allows me to buy any item on the first input, no matter how much it costs, and no matter how much gold I have, it then puts me into a minus figure for gold. If you after the first purchase try to buy something else, it does test to see if you have enough gold, and if not it stops you from buying it.

Code:
if (player.getGold() < mGoldRequired )

*********{
************cout << endl;
************cout << "You dont have enough gold for that" << endl;
************cout << endl;
******break ;
*********}
I have tried swapping the code around, using different operators etc, Dont understand as I am using the same piece of code that I used for magic points for spells, and that works fine. I am calling the get gold from player, and the mGoldRequired is set to private in store.h

Here is the complete file

Code:

// Store cpp
#include <iostream>
#include "Store.h"
#include "Random.h"
using namespace std;


void Store::enter(Player& player)

{

******int select;
******bool leave = false;

************cout << "Welcome to my store, what can I do for you?" << endl;
************cout << endl;

******while (!leave)

***{

************cout << "1) View Prices, 2) Buy Potions, 3) Buy Armor, 4) Rest a while, 5) Leave... ";
************cin >> select;
************cout << endl;


******switch(select)
******{

******case 1:
************cout << "==== POTIONS ====" << endl;
************cout << endl;
************cout << "Belt 500, Heal 100, Poison 100, Invisability 1000" << endl;
************cout << endl;
************cout << "==== ARMOR ====" << endl;
************cout << endl;
************cout << "Leather 100, Ring 200, Splintered 300, Mail 500" << endl;
************cout << endl;
*********break;
******
******case 2:
*********{
************cout << "What Potions would you like to buy?" << endl;
************cout << endl;
************cout << "We have 1) Belt, 2) Heal, 3) Poison, 4) Invisability...";
*********
************int potion = 1;
************cin >> potion;

*********if (player.getGold() < mGoldRequired )

*********{
************cout << endl;
************cout << "You dont have enough gold for that" << endl;
************cout << endl;
******break ;
*********}

***
******if(potion == 1)
*********{
************mPotionName    = "Belt";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 500 Gold"<< endl;
************cout << endl;
************mGoldRequired = 500;
************player.SetGold (- 500);
*********}

******else if(potion == 2)
*********{
************mPotionName    = "Heal";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 100 Gold"<< endl;
************cout << endl;
************mGoldRequired = 100;
************player.SetGold (- 100);
************player.SetHitPoints (+ 15);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}

******else if(potion == 3)
*********{
************mPotionName    = "Poison";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 100 Gold"<< endl;
************cout << endl;
************mGoldRequired = 100;
************player.SetGold (- 100);
************player.SetHitPoints (+ 50);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}

******else
*********{
************mPotionName    = "Invisability";
************cout << endl;
************cout << "You have purchased a " << mPotionName << " Potion for 1000 Gold" << endl;
************cout << endl;
************mGoldRequired = 1000;
************player.SetGold (- 1000);
************player.SetHitPoints (+ 200);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******break;
*********}

******case 3:

*********{
************cout << "What Armor would you like to buy?" << endl;
************cout << endl;
************cout << "We have 1) Leather, 2) Ring, 3) Splintered, 4) Mail...";
*********
*********int armor = 1;
*********cin >> armor;

******if (player.getGold() < mGoldRequired )

*********{
************cout << endl;
************cout << "You dont have enough gold for that" << endl;
************cout << endl;

******break ;
*********}

******if(armor == 1)
*********{
************mClothingName = "Leather Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 100 Gold "<< endl;
************cout << endl;
************mGoldRequired = 100;
************player.SetGold (- 100);
************player.SetHitPoints (+ 20);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}

******else if(armor == 2)
*********{
************mClothingName = "Ring Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 200 Gold " << endl;
************cout << endl;
************mGoldRequired = 200;
************player.SetGold (- 200);
************player.SetHitPoints (+ 30);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******

******else if(armor == 3)
*********{
************mClothingName = "Splintered Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 300 Gold " << endl;
************cout << endl;
************mGoldRequired = 300;
************player.SetGold (- 300);
************player.SetHitPoints (+ 40);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}

******else
*********{
************mClothingName = "Mail Armor";
************cout << endl;
************cout << "You have purchased " << mClothingName << " for 500 Gold " << endl;
************cout << endl;
************mGoldRequired = 500;
************player.SetGold (- 500);
************player.SetHitPoints (+ 50);
************player.SetMaxHitPoints ( player.getHitPoints());
*********}
******break;
*********}

******case 4:
*********{
*********int roll = Random(1, 4);

******if( roll == 1 )
******{
************cout << "A monster has also come to the shop" << endl;
************cout << endl;
************cout << "He picks your pocket and gets 150 Gold and 15 Magic Points" << endl;
************cout << endl;
******
************player.SetGold (- 150);
************player.SetMagicPoints (- 15);

******}
******else 
******{
************cout << "Do you want to rest" << endl;
************cout << endl;
************cout << "Rooms are 200, Chairs are 100 & Floor is 10 gold" << endl;
************cout << endl;
************cout << "1) Room, 2) Chair, 3) Floor...";

*********int rest = 1;
*********cin >> rest;
*********cout << endl;

******if (rest == 1)
*********{
************player.SetGold (- 200);***
************player.SetMaxHitPoints ( player.getHitPoints());
*********}

******else if (rest == 2)
*********{
************player.SetGold (- 100);
************player.SetHitPoints (+ 20);
************player.SetMaxHitPoints ( player.getHitPoints());

*********}

******else
*********{
************player.SetGold (- 10);***
************player.SetHitPoints (+ 5);
************player.SetMaxHitPoints ( player.getHitPoints());

*********}
************cout << "You are now rested" << endl;
************cout << endl;
*********}

******break;
*********}

******case 5:

************cout << "Thank you for coming, please come again" << endl;
************leave = true;
******}
******
***}

}