资源介绍
C++编程的许多实例讲解
例如贪吃蛇的一段代码:
//设置背景
void setBG(int length, int width){
HANDLE hOut;
COORD OutChar;
OutChar.X = 10;
OutChar.Y = 10;
int i = 0;
int j = 0;
for(i = 0; i < width; i++){
for(j = 0; j < length; j++){
bg[i][j].x = i;
bg[i][j].y = j;
bg[i][j].blocked = false;
bg[i][j].food = false;
OutChar.X = j+10;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hOut,OutChar);
cout << col(BG_WHITE,true) << " ";
}
cout << endl;
OutChar.Y = i+10;
SetConsoleCursorPosition(hOut,OutChar);
}
}
- 上一篇: VS2010做的执行外部程序实例
- 下一篇: Spring的所有架包