Archived

This topic is now archived and is closed to further replies.

AeroBLASTER

What's wrong with this code?

Recommended Posts


    
	if (wORa == 1)
	{
		cout << "\n\nLooking for some high-quality weaponry, eh?  Well, here's what I've got!\n\n";
		cout << "1) " << blade << "\nDamage: " << bladestat << "\nPrice: " << bladeprice << "\n\n";	
		cout << "2) " << broadsword << "\nDamage: " << broadswordstat << "\nPrice: " << broadswordprice << "\n\n";
		cout << "3) " << longsword << "\nDamage: " << longswordstat << "\nPrice: " << longswordprice << "\n\n";
		cout << "4) " << enchantedclaymore << "\nDamage: " << enchantedclaymorestat << "\nPrice: " << enchantedclaymoreprice << "\n\n";
		cout << "You have " << playergp << " gold.\n\n";
		cout << "Either type the number of your desired purchase, or type 5 to go back to the\n";
		cout << "Game menu.  ";
		cin >> weppurchase;
			if (weppurchase == 1)
			{
				if (playergp >= bladeprice)
				{
					cout << "\n\nYou have purchased a Blade.  Thanks, and have a nice day!";
					playergp = playergp - bladeprice;
					playerwep = bladestat;
					strcpy (playerwepname, blade);
				}
				else if (playergp < bladeprice)
				{
					cout << "\n\nYou do not have enough gold to purchase that weapon.";
				}
			else if (weppurchase == 2)
			{
				if (playergp >= broadswordprice)
				{
					cout << "\n\nYou have purchased a Broadsword.  Thanks, and have a nice day!";
					playergp = playergp - broadswordprice;
					playerwep = broadswordstat;
					strcpy (playerwepname, broadsword);
				}
				else if (playergp < broadswordprice)
				{
					cout << "\n\nYou do not have enough gold to purchase that weapon.";
				}
			}
			}
			else if (weppurchase == 1337)
			{
				cout << "In a magestic sparkling of light, 500 gold mysteriously appears in your wallet!";
				playergp = playergp + 500;
			}
	}  
Okay, so basically what this is is a weapon purchasing system. The "weppurchase == 1337" portion is just a 'cheat code' for testing. The problem is, while the first selection works fine (the blade part), the second (the broadsword part) doesn't work at all - it doesn't do anything. What am I missing? [edited by - AeroBLASTER on August 14, 2002 4:08:45 PM]

Share this post


Link to post
Share on other sites