[ create a new paste ] login | about

Link: http://codepad.org/Occ2VZHj    [ raw code | fork ]

C++, pasted on Aug 24:
string UserName;
string PlayerInv = "\nInventory:";
string ARROW = "\nArrows x";
stringstream ss;
int Money;
int PlayerHP = 75;
int Foodx = 0;
int Drinkx = 0;
int arrowx = 0;
bool arrow_owned = false;
enum ShopMisc{Arrow = 2, Food = 10, Drink = 10,WeaponPoison = 35,} //Ignore all but arrow

//////////////////////////////
case 1:
                 {
                   cout << "How many Arrows would you like? :";
                   cin >> arrowchoice;
                   Sleep(1000);
                   cout << "\nYou have chose "<<arrowchoice<< "  Arrows costing " <<(Arrow*arrowchoice)<<" Gold peices\n";
                   if(Money - (Arrow*arrowchoice) >= 0)
                   {
                            if(arrow_owned == true)
                            {                                                           //just a guess so its obv wrong
                                ss >> PlayerInv >> ARROW >> arrowx;
                                Money = (Money - (Arrow*arrowchoice));
                                cout << "You now have: " << Money << " Gold peices\n";
                                arrowx = (arrowx + arrowchoice);
                                ss << PlayerInv << ARROW << arrowx;
                                PlayerInv = ss.str();
                                goto SHOPEND;
                            }                 
                   Money = (Money - (Arrow*arrowchoice));
                   cout << "You now have: " << Money << " Gold peices\n";
                   arrowx = (arrowx + arrowchoice);
                   ss <<PlayerInv << ARROW << arrowx;
                   PlayerInv = ss.str();      
                   arrow_owned = true;
                   goto SHOPEND;
                   }
                   else
                   {
                   cout << "You dont have enough gold for "<< arrowchoice << "arrows\n";
                   goto SHOPEND;                  
                   }
                 }


Create a new paste based on this one


Comments: