我已经学习编程一年了,现在被分配制作一个俄罗斯方块游戏。我试图显示游戏所用的桶,它必须是25 x 12。我尝试使用嵌套循环的方式思考和研究如何实现这一点,但一直没有成功。除此之外,我发现我的代码有错误C2078: too many initializers。请问有人可以看看我的代码并找到我没有发现的问题,或者找到更有效绘制桶的方法吗?感谢您提供的任何帮助。谢谢。
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
const int width = 12;
const int height = 25;
char bucket [width][height] ={"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x"," "," "," "," "," "," "," "," "," "," ","x",
"x","x","x","x","x","x","x","x","x","x","x","x",
};
void setCursorTo(int x, int y){
HANDLE handle;
COORD position;
handle = GetStdHandle(STD_OUTPUT_HANDLE);
position.X = x;
position.Y = y;
SetConsoleCursorPosition(handle, position);
}
int _tmain(int argc, _TCHAR* argv[])
{
setCursorTo(0,0);
cout<<bucket<<endl;
return 0;
}enter code here
null
字符。感谢您指出这一点。 - Vinícius Gobbo A. de Oliveira