I am working on the battle sequence for a game about a zombie attack. I am making the code and my friend Trent is making the scenario and creative elements. I have been having trouble getting the structure for weapons to transfer from the main function to the battle function. I need to be able to declare the structure in the main function and then let the battle function use the variables in the structure. The variables need to be able to be modified in in the main structure because. I wanted the user to eventually be able to select different weapons with different stats. They will be able to carry a set number of weapons so I made a structure that holds the pertinent data, weapon name, the phrase it displays when you attack, attack power range.

I realize this is probably a noob question. And although I looked through the forum and found something about putting STRUCTURENAME &INSTANCE in the arguments to the function in order to allow the function to access a variable from another structure. But I never fully understood pointers.

Here is the pertinent code:

Code:
#include <iostream>

#include <windows.h>

#include <time.h>

using namespace std;

void clrscrn ( void ){}		//clears the screen, I got it on here and I tested it so it works

int high;
int low;
int playerhp;
int playeratk;
int playerdef;
int choice;

class zombie {			//the enemy, eventually there will be multiple classes of enemies
    public:
    zombie (){
        zohp = 100;
    }
    ~zombie (){
        }
    int zohp;
    int atkdmg;
	int atkpwr;
	void attack ( void );
};

struct weapon {			//this is the structure i need to work right
    string name;
    int crit;
    int min;
    int dmg;
    string atktxt;
};

void battle ( void );

int main(){
    time_t seconds;
    time (&seconds);
    srand((unsigned int) seconds);
    struct weapon one;		//I want to be able to declare the information in the main function so it can change mid-game
    one.name = "flail";
    one.crit = 50;
    one.min = 25;
    one.atktxt = "You swing the flail in a circle in\nin preparation to hitting the zombie\nin the face...and then strike";
    struct weapon two;
    two.name = "battleaxe";
    two.min = 50;
    two.crit = 100;
    two.atktxt = "You swing the battle axe as hard as\nat about head height";

    cout<<"Beginning battle sequence with Zombie at 100 hp\n";
    playerhp = 100;
    playeratk = 40;
    battle();			//Here is the function that uses the weapon string
}

void battle ( void ){
    zombie bob;			//Making one enemy of the type zombie named bob
    while (playerhp > 0 and bob.zohp > 0){
    clrscrn();			//Pick a weapon
    cout<<"Use what weapon?\n\n1. " << one.name << "  " << one.min << " - " << one.crit;
    cout << "\n2. ";
    cout << two.name;
    cout << "  ";
    cout << two.min;
    cout << " - ";
    cout << two.crit;
    cout << "\n\n";
    cin>>choice;
    clrscrn();
    switch (choice) {		//do damage depending on selection and display text depending on selection
        case 1:
        one.dmg = rand() % (one.crit - one.min + 1) + one.crit;
        cout<<one.atktxt;
        cout<<"\n\nThe zombie took " << one.dmg << " damage";
        bob.zohp = bob.zohp - one.dmg;
        one.dmg = 0;
        cin.get();
        clrscrn();
        break;
        case 2:
        two.dmg = rand() % (two.crit - two.min + 1) + two.crit;
        cout<<two.atktxt;
        cout<<"\n\nThe zombie took " << two.dmg << " damage";
        bob.zohp = bob.zohp - two.dmg;
        two.dmg = 0;
        cin.get();
        clrscrn();
        default:
        cout<<"You have to pick an actual option...\nso now you don't get to attack\n";
        cin.get();
        clrscrn();
    }
    bob.attack();
    }
    if (playerhp <= 0){
        cout<<"Good Job Numb Nuts,\n\nYou Died\n";
        cin.get();
        exit(1);
    }
    if (bob.zohp <= 0) {
        cout<<"The zombie begins eating his own hand\ntrying to regain health\n\nYou Won\n";
        cin.get();
        clrscrn();
    }
    else {
        cout<<"There is an error...neither you nor the zombie has died\n\nPlease report this to the maker\n";
        cin.get();
        exit(1);
    }
}

void zombie::attack (void) {
        int playerdef;
        int playerhp;
        low = 1;
        high = 3;
        int attacktype = rand() % (high - low + 1) + low;
        switch (attacktype){
            case 1: //bite
            low = 15;
            high = 25;
            atkpwr = rand() % (high - low + 1) + low;
            atkdmg = atkpwr - playerdef;
            if (atkdmg >=0) {
                  playerhp = playerhp - atkdmg;
                  cout<<"The zombie bit you\n\nYou lost " << atkdmg << " hp\n";
            }
            if (atkdmg <0 ) {
                  cout<<"You defend against the zombie's\nfeeble attack and suffer no damage\n";
            }
            else {
                  cout<<"Something is wrong with the program.\nPlease tell the creator that the problem occured\nDuring the zombie bite sequence\n";
            }
            break;
            case 2://gnaw
            low = 20;
            high = 30;
            atkpwr = rand() % (high - low + 1) + low;
            atkdmg = atkpwr - playerdef;
            if (atkdmg >=0) {
                  playerhp = playerhp - atkdmg;
                  cout<<"The zombie gnaws on your arm\n\nYou lost " << atkdmg << " hp\n";
            }
            if (atkdmg <0 ) {
                  cout<<"You defend against the zombie's\nfeeble attack and suffer no damage\n";
            }
            else {
                  cout<<"Something is wrong with the program.\nPlease tell the creator that the problem occured\nDuring the zombie gnaw sequence\n";
            }
            break;
            case 3:
            cout<<"The zombie moans irratically instead of eating you\n";
            break;
            Default:
            cout<<"The program isn't working right\n\nPlease report the error and\ntell the clreator that it occured in the zombie attack function\n";
            break;
        }
        cout<<"\n\nYour HP down to " << playerhp;
        cin.get();
        clrscrn();}
I never really understood pointers, so if you could help me i would kneel before you.