c++类中数组怎么赋值

能编译,但运行出来结果不对,
应该是赋值函数的问题
代码:
#include<iostream>
using namespace std;
class Game{
protected:
float health=0;
int i=0,j=0;
int maps[15][15];//将要赋值的数组
public:

void change(int x2,int y2,int value1){
maps[x2][y2]=value1;
}
void inmap(int map[15][15]){ //赋值函数
for(i=0;i<=10;i++){
for(j=0;j<=10;j++){
maps[i][j]=map[i][j];

}
}
};

private:

};
class Player: public Game{
public:
void showMap(){ //输出数组函数
for(i=0;i<=10;i++){
for(j=0;j<=10;j++){
cout<<maps[i][j];
}
cout<<endl;
}
}
void showText(char playername[15]){
cout<<text<<endl;
}
void move(int x1,int y1){
x=x1;
y=y1;
}
private:
int x=0,y=0;
int text;
};
int main(){
int map[15][15];
int i=0,j=0,k=0,l=0;
Game game1;
Player player1;
for(i=0;i<=10;i++){
for(j=0;j<=10;j++){
map[i][j]=1;
}
}
int nullmap[15][15];
game1.inmap(map);
player1.showMap();
return 0;
}
请各位大神指点。。。

第1个回答  2017-08-19
void inmap(int map[15][15]){ //赋值函数
for(i=0;i<=10;i++){
for(j=0;j<=10;j++){
maps[i][j]=i*j;

}
}
};本回答被提问者和网友采纳
相似回答