|
||||||||||
|
|
#1 (permalink) |
|
Googler
![]() Join Date: Dec 2008
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
![]() |
inventory
//inventory game
#include<iostream.h> #include<time.h> using namespace std; int main() { srand(time(NULL)); const int MAXITEMS=10; string inventory[MAXITEMS]; int numitems=0; //store "sword" at position 0 inventory[0]="sword"; numitems=numitems+1; //store "armor" at postion 1 inventory[1]="armor"; numitems=numitems+1; //store "shield" at position 2 inventory[2]="shield"; numitems=numitems+1; //store "gold" at position 3 inventory[3]="gold"; numitems=numitems+1; //store "amulet" at position 4 inventory[4]="amulet"; numitems=numitems+1; //store "bow and arrows" at position 5 inventory[5]="bow and arrows"; numitems=numitems+1; //store "AK-47" at position 7 inventory[6]="AK-47"; numitems=numitems+1; //store "spare underware" at position 8 inventory[7]="spare underware"; numitems=numitems+1; //store "thunder hammer" at position 9 inventory[8]="thunder hammer"; numitems=numitems+1; cout<<"your items:\n"; for(int i=0; i<numitems; i++) cout<<inventory[i]<<endl; cout<<endl; cout<<endl; cout<<"You buy a battle axe with your gold.\n\n"; inventory[3]="battle axe"; cout<<"Your items:\n"; for(int i=0; i<numitems; i++) cout<<inventory[i]<<endl; cout<<"\n You find a healing potion\n\n"; if(numitems<MAXITEMS) { inventory[9]="healing potion"; numitems=numitems+1; } else cout<<"you have too many items and can't carry another."; cout<<"your items:\n"; for(int i=0; i<numitems; i++) cout<<inventory[i]<<endl; cout<<endl; cout<<"The current number of items is "<<numitems<<endl; cout<<endl; const int macitems=15; string Bag[macitems]; int items=0; cout<<"This Druid wants his own item inventory HELP HIM!!!!"<<endl; cout<<endl; //store "stick" at position 0 Bag[0]="stick"; items=items+1; //store "wooden shield" at position 1 Bag[1]="wooden shield"; items=items+1; //store "rock" at position 2 Bag[2]="rock"; items=items+1; //store "light armor" at position 3 Bag[3]="leather armor"; items=items+1; //store "magic pebble" at position 4 Bag[4]="magic pebble"; items=items+1; //store "sand in pocket" at position 5 Bag[5]="sand in pocket"; items=items+1; //store "Herbs" at position 6 Bag[6]="Herbs"; items=items+1; //store "potion of mana" at position 7 Bag[7]="potion of mana"; items=items+1; //store "scroll" at position 8 Bag[8]="scroll"; items=items+1; //store "fur helmet" at position 9 Bag[9]="fur helmet"; items=items+1; //store "GODS RIGHT HAND" at position 10 Bag[10]="GODS RIGHT HAND"; items=items+1; cout<<"Druid's items:\n"; for(int i=0; i<items; i++) cout<<Bag[i]<<endl; return 0; } |
|
|
|
|
Sponsored Links
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Google tests ad platform and inventory manager - Register | News Alerts | Google in the News | 0 | 03-13-2008 01:47 PM |
| Google Unveils Ad Inventory Management Tool - InformationWeek | News Alerts | Google in the News | 0 | 03-13-2008 12:34 PM |
| GC Shop Inventory | debayanroy | General Discussion | 1 | 07-17-2006 04:29 AM |
| More Inventory | TekeeTakShak | GC Announcements | 6 | 07-10-2006 11:53 PM |