void player::store()
{
int menuChoice;
int amountChoice = 0;
int items[4] = {0,0,0,0};
string inv;
cout << "\nWelcome to the store what do you want to buy?" << endl;
cout << "1) Health Pack - $20" << endl;
cout << "2) Pistol Ammo - $30" << endl;
cout << "3) Shotgun Ammo - $50" << endl;
cout << "4) Rifle Ammo - $80" << endl;
cin >> menuChoice;
switch(menuChoice)
{
case 1:
{
cout << "How many Health Packs do you want to buy?" << endl;
cin >> amountChoice;
items[1] = amountChoice;
amountChoice = 0;
}break;
case 2:
{
cout << "How much Pistol Ammo do you want to buy?" << endl;
cin >> amountChoice;
items[2] = amountChoice;
amountChoice = 0;
}break;
case 3:
{
cout << "How much Shotgun Ammo do you want to buy?" << endl;
cin >> amountChoice;
items[3] = amountChoice;
amountChoice = 0;
}break;
case 4:
{
cout << "How much Rifle Ammo do you want to buy?" << endl;
cin >> amountChoice;
items[4] = amountChoice;
amountChoice = 0;
}break;
default:
cout << "Thank you for shopping at the store!!" << endl;
}
cout << "Items bought:\n" << endl;
cout << "Health Packs: " << items[1] << endl;
cout << "Pistol Ammo: " << items[2] << " rounds" << endl;
cout << "Shotgun Ammo: " << items[3] << " rounds" << endl;
cout << "Rifle Ammo: " << items[4] << " rounds" << endl;
backpack();
}
void player::backpack(int &items[4])
{
cout << items[1] << endl;
cout << items[2] << endl;
cout << items[3] << endl;
cout << items[4] << endl;
}
errors
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|81|error: declaration of 'items' as array of references|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|81|error: prototype for 'void player::backpack(...)' does not match any in class 'player'|
C:\Users\Chay\Desktop\Dinosaur Arena\player.h|24|error: candidate is: void player::backpack()|
C:\Users\Chay\Desktop\Dinosaur Arena\MainGame.h|81|error: prototype for 'void player::backpack(int (&)[4])' does not match any in class 'player'|
C:\Users\Chay\Desktop\Dinosaur Arena\player.h|24|error: candidate is: void player::backpack()|
||=== Build finished: 2 errors, 0 warnings ===|