Google Community
Latest Forums Rules Resources
Custom Search

Go Back   Google Community > The Community > Chit Chat

GoogleCommunity Sponsor

Reply
 
LinkBack Thread Tools Display Modes
Old 05-22-2009, 04:56 AM   #1 (permalink)
Googler
 
Join Date: Dec 2008
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
wolfyy1 is on a distinguished road
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;
}
wolfyy1 is offline   Reply With Quote
 
Sponsored Links
Old 06-04-2009, 12:30 PM   #2 (permalink)
Elite Googler
 
desigac's Avatar
 
Join Date: Jul 2007
Posts: 1,300
Thanks: 12
Thanked 31 Times in 30 Posts
desigac is on a distinguished road
What is this

What is this










Chennai Jobs Online | Chennai Part Time Jobs | Chennai Work at home | Data Entry Jobs |Job
desigac is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



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


All times are GMT -8. The time now is 05:05 PM.


Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0
© 2004–2007 Google Community