0

我正在编写一个地牢爬行者 ascii 类型的游戏,并且我已经开始测试我的显示系统并且它无法正常工作。

#include <iostream>
std::string anything;
int end;
char page1[10] [10];
char Pix[10] [10];
std::string PageNumber;
using namespace std;

int main(){
//Reset level into Screen Mem
page1[0] [0] = 'W';
if(PageNumber == "page1"){
      Pix[0] [0] = page1[0] [0];
      Pix[0] [1] = page1[0] [1];
      Pix[0] [2] = page1[0] [2];
      Pix[0] [3] = page1[0] [3];
      Pix[0] [4] = page1[0] [4];
      Pix[0] [5] = page1[0] [5];
      Pix[0] [6] = page1[0] [6];
      Pix[0] [7] = page1[0] [7];
      Pix[0] [8] = page1[0] [8];
      Pix[0] [9] = page1[0] [9];
      Pix[1] [0] = page1[1] [0];
      Pix[1] [1] = page1[1] [1];
      Pix[1] [2] = page1[1] [2];
      Pix[1] [3] = page1[1] [3];
      Pix[1] [4] = page1[1] [4];
      Pix[1] [5] = page1[1] [5];
      Pix[1] [6] = page1[1] [6];
      Pix[1] [7] = page1[1] [7];
      Pix[1] [8] = page1[1] [8];
      Pix[1] [9] = page1[1] [9];
      Pix[2] [0] = page1[2] [0];
      Pix[2] [1] = page1[2] [1];
      Pix[2] [2] = page1[2] [2];
      Pix[2] [3] = page1[2] [3];
      Pix[2] [4] = page1[2] [4];
      Pix[2] [5] = page1[2] [5];
      Pix[2] [6] = page1[2] [6];
      Pix[2] [7] = page1[2] [7];
      Pix[2] [8] = page1[2] [8];
      Pix[2] [9] = page1[2] [9];
      Pix[3] [0] = page1[3] [0];
      Pix[3] [1] = page1[3] [1];
      Pix[3] [2] = page1[3] [2];
      Pix[3] [3] = page1[3] [3];
      Pix[3] [4] = page1[3] [4];
      Pix[3] [5] = page1[3] [5];
      Pix[3] [6] = page1[3] [6];
      Pix[3] [7] = page1[3] [7];
      Pix[3] [8] = page1[3] [8];
      Pix[3] [9] = page1[3] [9];
      Pix[4] [0] = page1[4] [0];
      Pix[4] [1] = page1[4] [1];
      Pix[4] [2] = page1[4] [2];
      Pix[4] [3] = page1[4] [3];
      Pix[4] [4] = page1[4] [4];
      Pix[4] [5] = page1[4] [5];
      Pix[4] [6] = page1[4] [6];
      Pix[4] [7] = page1[4] [7];
      Pix[4] [8] = page1[4] [8];
      Pix[4] [9] = page1[4] [9];
      Pix[5] [0] = page1[5] [0];
      Pix[5] [1] = page1[5] [1];
      Pix[5] [2] = page1[5] [2];
      Pix[5] [3] = page1[5] [3];
      Pix[5] [4] = page1[5] [4];
      Pix[5] [5] = page1[5] [5];
      Pix[5] [6] = page1[5] [6];
      Pix[5] [7] = page1[5] [7];
      Pix[5] [8] = page1[5] [8];
      Pix[5] [9] = page1[5] [9];
      Pix[6] [0] = page1[6] [0];
      Pix[6] [1] = page1[6] [1];
      Pix[6] [2] = page1[6] [2];
      Pix[6] [3] = page1[6] [3];
      Pix[6] [4] = page1[6] [4];
      Pix[6] [5] = page1[6] [5];
      Pix[6] [6] = page1[6] [6];
      Pix[6] [7] = page1[6] [7];
      Pix[6] [8] = page1[6] [8];
      Pix[6] [9] = page1[6] [9];
      Pix[7] [0] = page1[7] [0];
      Pix[7] [1] = page1[7] [1];
      Pix[7] [2] = page1[7] [2];
      Pix[7] [3] = page1[7] [3];
      Pix[7] [4] = page1[7] [4];
      Pix[7] [5] = page1[7] [5];
      Pix[7] [6] = page1[7] [6];
      Pix[7] [7] = page1[7] [7];
      Pix[7] [8] = page1[7] [8];
      Pix[7] [9] = page1[7] [9];
      Pix[8] [0] = page1[8] [0];
      Pix[8] [1] = page1[8] [1];
      Pix[8] [2] = page1[8] [2];
      Pix[8] [3] = page1[8] [3];
      Pix[8] [4] = page1[8] [4];
      Pix[8] [5] = page1[8] [5];
      Pix[8] [6] = page1[8] [6];
      Pix[8] [7] = page1[8] [7];
      Pix[8] [8] = page1[8] [8];
      Pix[8] [9] = page1[8] [9];
      Pix[9] [0] = page1[9] [0];
      Pix[9] [1] = page1[9] [1];
      Pix[9] [2] = page1[9] [2];
      Pix[9] [3] = page1[9] [3];
      Pix[9] [4] = page1[9] [4];
      Pix[9] [5] = page1[9] [5];
      Pix[9] [6] = page1[9] [6];
      Pix[9] [7] = page1[9] [7];
      Pix[9] [8] = page1[9] [8];
      Pix[9] [9] = page1[9] [9];
}
//Screen Print
int X;
int Y;
for(X = 0, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 1, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 2, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 3, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 4, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 5, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 6, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 7, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 8, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
cout << endl;
for(X = 9, Y = 0; Y <= 9; Y++)
{
    cout << Pix[X] [Y];
}
return 0;
}

我的显示系统正在从 page1 中获取一个单元格并将其放入 Pix 中的相同单元格中,因此它应该显示一个“W”但它不是。

4

1 回答 1

2

由于您从不初始化任何值,因此您只是在编写一堆零字符和换行符。这两个字符都不可见,所以没有什么可看的。

于 2012-08-27T02:23:07.527 回答