Multidimensional issue with arrays

here is the code with the problem:

#ifndef WEAPONS_H_INCLUDED
#define WEAPONS_H_INCLUDED
#include "Battleship header.h"

void Player::torpedo(string enemyEvtTracker[][10], string myhitboard[][10])
{
    string bcn; //board column number
    cout << "Enter board column number (1-9): "; cin >> bcn; flush();
    if(bcn!="1"&&bcn!="2"&&bcn!="3"&&bcn!="4"&&bcn!="5"&&bcn!="6"&&bcn!="7"&&bcn!="8"&&bcn!="9")
    {cout <<endl<< "That is not a valid number.";}
    return;
}



#endif // WEAPONS_H_INCLUDED

here is the Player class:

#ifndef BATTLESHIPPLAYERCLASS_H_INCLUDED
#define BATTLESHIPPLAYERCLASS_H_INCLUDED
using namespace std;
class Player // define a class for a player
{
    void torpedo(string enemyEvtTracker[10][10], string myhitboard[10][10]);
    void cannon();
    void scatter();
    void menu();
    friend int main(int, char*[]);   //Let main access the protected members
    friend int routine_END(void);
    public:
    void displaydata()
    {cout << money << endl << gunpowder << endl << ammo_cannon << endl << ammo_4hit << endl;}
    string savename;
    int gunpowder;
    int ammo_cannon;
    int ammo_4hit; string gun_4;
    int ammo_scatter; string gun_s;
    int money;
    Player(string name){money=18000; gunpowder=100;ammo_cannon=20; ammo_4hit=0; ammo_scatter=0; gun_4="OFF"; gun_s="OFF";playername=name;}  //Define the constructor
    void simplegame(void) {gunpowder=99999999; ammo_cannon=999999999; ammo_scatter=4; gun_s="ON";}
    void getname(string *playername, int option)
    {
        if (option==1)
        {cout << "Enter your name here player 1:"; cin >> *playername;}
        else {cout << "Enter your name here player 2:"; cin >> *playername;}
    }
    string playername;
    char mainRowGuess;
    int check_transaction (int mymoney, int moneyowed)
    {
        if (mymoney-moneyowed<<0) {return 0;}
        else {return 1;}
    }
    void change_Answer_to_number(char row,int* outputRow)
    {
            if (row=='A'||row=='a'){*outputRow =1;}
       else if (row=='B'||row=='b'){*outputRow =2;}
       else if (row=='C'||row=='c'){*outputRow =3;}
       else if (row=='D'||row=='d'){*outputRow =4;}
       else if (row=='E'||row=='e'){*outputRow =5;}
       else if (row=='F'||row=='f'){*outputRow =6;}
       else if (row=='G'||row=='g'){*outputRow =7;}
       else if (row=='H'||row=='h'){*outputRow =8;}
       else if (row=='I'||row=='i'){*outputRow =9;}
       else {*outputRow = 0;}
    }
    void changeCharToNumber(char row, int* outputRow)
    {
            if (row=='1'){*outputRow=1;}
       else if (row=='2'){*outputRow=2;}
       else if (row=='3'){*outputRow=3;}
       else if (row=='4'){*outputRow=4;}
       else if (row=='5'){*outputRow=5;}
       else if (row=='6'){*outputRow=6;}
       else if (row=='7'){*outputRow=7;}
       else if (row=='8'){*outputRow=8;}
       else if (row=='9'){*outputRow=9;}
       else {cout << "Unexpected Error." << endl; *outputRow=0;}

    }
  char airRowStart; char airColStart; char aircraftDirec;
  char destRowStart; char destColStart; char destroyerDirec;
  char subRowStart; char subColStart; char subDirec;
  char patrolStart; char patrolDirec;
    /// START MENU FUNCTION
    void error_money(void) {cout << "Not enough money!";}
    char startRowAircraftCarrier;
    char startRowDestroyer;
    char startRowSub;
    char startRowPatrolBoat;

    friend int routine_END (void);
    friend void menu (int* gunpowder, int* ammo_cannon, int* ammo_4hit, int* ammo_scatter, int* money, string* gun_4, string* gun_s);


};



#endif // BATTLESHIPPLAYERCLASS_H_INCLUDED

and this creates the next build log ...

-------------- Build: debugging in Advanced Battleship Obj

[50.0%] : main.cpp C:\Advanced_Battleship_Revised_5111\main.cpp: 32: : #pragma comment In C:\Advanced_Battleship_Revised_5111 \/imputoutput.h: 9,                   C:\Advanced_Battleship_Revised_5111 \/ header.h: 3,                   C:\Advanced_Battleship_Revised_5111\main.cpp: 25: C:\Advanced_Battleship_Revised_5111 \/BattleshipPlayerClass.h: 74: : 'int procedure_END()' "" C:\Advanced_Battleship_Revised_5111 \/BattleshipPlayerClass.h: - int Player:: check_transaction (int, int) ': C:\Advanced_Battleship_Revised_5111 \/BattleshipPlayerClass.h: 33: : '-' '< < , C:\Advanced_Battleship_Revised_5111\main.cpp: 27: C:\Advanced_Battleship_Revised_5111 \/BattleshipMenu.h: 'void :: () ': C:\Advanced_Battleship_Revised_5111 \/BattleshipMenu.h: 118: : label 'GUNPOWDER_MENU_1' C:\Advanced_Battleship_Revised_5111 \/BattleshipMenu.h: 166: : 'CIN_WEAPON_OPTION_SCATTER_CANNON' C:\Advanced_Battleship_Revised_5111\main.cpp: 30: C:\Advanced_Battleship_Revised_5111 \/weapons.h: : C:\Advanced_Battleship_Revised_5111 \/weapons.h: 5: : "enemyEvtTracker" , C:\Advanced_Battleship_Revised_5111 \/weapons.h: 5: : ')' ',' C:\Advanced_Battleship_Revised_5111 \/weapons.h: 5: : , ',' C:\Advanced_Battleship_Revised_5111 \/weapons.h: 5: : , "myhitboard" 1 (0 , 1 ) 4 , 5

+3
1
Player::torpedo(string enemyEvtTracker[10][10], string myhitboard[10][10])
{
  //..
}

-. ?

, , . , enemyEvtTracker [][]? . Player , - torpedo.

+3

All Articles