user-0 提问: 各位大神看看我的C语言WIN32 俄罗斯方块 程序问题在哪。

回复:
user: user-1
content: 代码功能归根结底不是别人帮自己看或讲解或注释出来的；而是被自己静下心来花足够长的时间和精力亲自动手单步或设断点或对执行到某步获得的中间结果显示或写到日志文件中一步一步分析出来的。 提醒：再牛×的老师也无法代替学生自己领悟和上厕所！ 单步调试和设断点调试（VS IDE中编译连接通过以后，按F10或F11键单步执行，按Shift+F11退出当前函数；在某行按F9设断点后按F5执行停在该断点处。）是程序员必须掌握的技能之一。

user: user-2
content: 我想问，用什么算法的，以前读书时候，我搞了好久搞不出来

user: user-3
content: 一个控制台版本的俄罗斯方块，仅供参考

user: user-4
content: 最好能调试一下，再有疑问的地方设断点，然后分析为什么没有发生你想要的情况。  所以如果贴的是代码，不是图片的话，别人也可以运行一下，直接看代码有些问题很难发现。

user: user-0
content: 估计大神都吃饭去了吧。自己顶个吧。

user: user-0
content: 新问题出现了 1,.防止左移出借那里 2.防止右移出界那里 3 落到底的块会闪，是定时器的原因吗？4还是hdc的问题，1楼。  谢谢所有大神！ /*=============加好注释了，大神请阅==============*/ #include <windows.h> #include "resource.h" #define ID_TIMER 1 LRESULT CALLBACK kkk(HWND hwnd,UINT message,WPARAM wPARAM,LPARAM lParam); void CALLBACK TimerPro(HWND hwnd,UINT message,UINT TimerId,DWORD nTime); HDC hdc; HWND hwnd; HINSTANCE hins;  void zaokuai();//造块 void luokuai();//落块 void yideweizhi();//一的位置 void zuoyi();//左移 void youyi();//右移 void kuaisuluo();//快速落 BOOL nengluo();//能落不 void bsx();//变实心 void xsshixin();//显示实心  char as[20][10] = { 0 }; //初始化一个游戏界面的数组，20行，10列。 //窗口主函数 int __stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR pCmdline,int nCmdShow) { 	MSG msg; 	WNDCLASSEX cg; 	cg.cbClsExtra = 0; 	cg.cbWndExtra = 0; 	cg.cbSize = sizeof(WNDCLASSEX); 	cg.hCursor = LoadCursor(NULL,MAKEINTRESOURCE(IDC_NO)); 	cg.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 	cg.hIcon =LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1)); 	cg.hIconSm = NULL; 	cg.hInstance =hInstance; 	cg.lpfnWndProc = kkk; 	cg.lpszClassName = "HAHAHA"; 	cg.lpszMenuName = NULL; 	cg.style = CS_HREDRAW|CS_VREDRAW; 	  	RegisterClassEx(&cg); 	hwnd = CreateWindow("HAHAHA","俄罗斯",WS_OVERLAPPEDWINDOW,50,50,500,630+8,NULL,NULL,hInstance,NULL); 	ShowWindow(hwnd,nCmdShow); 	hins = hInstance; 	while(GetMessage(&msg,NULL,0,0)) 	{ 		TranslateMessage(&msg); 		DispatchMessage(&msg); 	} 	return 0; } //消息回传函数，定时器写外面了 LRESULT CALLBACK kkk(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) { 	PAINTSTRUCT ps; 	switch(message) 	{ 	case WM_PAINT: 		hdc = BeginPaint(hwnd,&ps); 		SelectObject(hdc,GetStockObject(GRAY_BRUSH)); 		Rectangle(hdc,0,0,300,600);//画游戏界面和下一个块的现实界面 		Rectangle(hdc,320,20,470,170); 		zaokuai();//画块 		EndPaint(hwnd,&ps); 		break; 	case WM_COMMAND: 		switch(wParam) 		{ 		case 1001: 			MessageBox(NULL,"游戏开始！","确认",MB_OK);//开始键，还不能用 			break; 		} 		break; 	case WM_KEYDOWN: 		switch(wParam) 		{ 		case VK_LEFT: 			zuoyi(); 			break; 		case VK_RIGHT: 			youyi(); 			break; 		case VK_DOWN: 			kuaisuluo();//快速落 			break; 		} 		break; 	case WM_CREATE: 		yideweizhi(); 		SetTimer(hwnd,1,600,TimerPro);//设置定时器600ms下落 		CreateWindow("button","START",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,350,400,100,50,hwnd,(HMENU)1001,((LPCREATESTRUCT) lParam)->hInstance,NULL); 		CreateWindow("static","分数：",WS_CHILD|WS_VISIBLE|SS_LEFT,350,190,45,30,hwnd,(HMENU)1002,((LPCREATESTRUCT) lParam)->hInstance,NULL); 		CreateWindow("static","等级：",WS_CHILD|WS_VISIBLE|SS_LEFT,350,240,45,30,hwnd,(HMENU)1003,((LPCREATESTRUCT) lParam)->hInstance,NULL); 		break; 	case WM_CLOSE: 		PostQuitMessage(0); 		KillTimer(hwnd,1); 		KillTimer(hwnd,2); 		break; 	} 	return DefWindowProc(hwnd,message,wParam,lParam); } //定时器消息回传函数 void CALLBACK TimerPro(HWND hwnd,UINT message,UINT TimerId,DWORD nTime) { 	hdc = GetDC(hwnd); 	SelectObject(hdc,GetStockObject(GRAY_BRUSH)); 	Rectangle(hdc,0,0,300,600); 	Rectangle(hdc,320,20,470,170); 	if(nengluo()) //判断是否能落，不能落则变实心 	{ 		luokuai(); 	} 	else 	{	MessageBeep(-1);//试验用 		bsx(); 	} 	zaokuai();//造块 	xsshixin();//显示实心 	ReleaseDC(hwnd,hdc); } //创建块 void zaokuai() { 	int hang, 		lie; 	char bs[10]; 	for (hang = 0;hang<20;hang++)//遍历所有行和列，如果有1就画出来。 	{ 		for (lie = 0;lie <10;lie++) 		{ 			if (as[hang][lie]) 			{ 				SelectObject(hdc,GetStockObject(WHITE_PEN)); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 				SelectObject(hdc,CreateSolidBrush(RGB(255,64,14))); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 				 			}							 			 		} 	} }  //一的位置，有1就画一个块，这里是个向下的T型 void yideweizhi() { 	as[0][3] = 0;as[0][4] = 1;as[0][5] = 1;as[0][6] = 1; 	as[1][3] = 0;as[1][4] = 0;as[1][5] = 1;as[1][6] = 0; 	as[2][3] = 0;as[2][4] = 0;as[2][5] = 0;as[2][6] = 0; 	as[3][3] = 0;as[3][4] = 0;as[3][5] = 0;as[3][6] = 0; }  //让快不断下落 void luokuai() { 	int hang, 		lie; 	for (hang = 18;hang>=0;hang--)//遍历所有行和列，如果有1就下落 	{ 		for (lie = 0;lie <=10;lie++) 		{ 			if (1 == as[hang][lie]) 			{ 				as[hang+1][lie] = 1;//行加一实现下落 				as[hang][lie] = 0; 			} 		} 	} }  //左移 void zuoyi()//左移一直按着块向上移的问题解决了，原因是我遍历行的时候for循环是里写的是hang-- { 	int hang, 		lie; 	for (hang = 0;hang<20;hang++)//同上遍历，按下左键调用，有1就列减一 	{ 		for (lie = 1;lie <10;lie++) 		{ 			if (1 == as[hang][lie] && ( 0<lie&&lie<10 ) )//这里出问题了，防止超出左边边界但是继续左移都堆一起了，想不到办法 			{ 				as[hang][lie-1] = 1; 				as[hang][lie] = 0; 			} 		} 	} } //右移 void youyi() { 	int hang, 		lie; 	for (hang = 0;hang<20;hang++)//遍历所有行和列 	{ 		for (lie = 10;lie >=0;lie--) 		{ 			if (1 == as[hang][lie] && ( 0<lie&&lie<=10 ) )//这里出问题了，防止超出右边边界但是继续右移穿越到左边了，思维混乱 			{ 				as[hang][lie+1] = 1;//列加一 				as[hang][lie] = 0; 			} 		} 	} } //快速下落函数 void kuaisuluo() { 	KillTimer(hwnd,1); 	SetTimer(hwnd,2,10,TimerPro);//设置新的定时器2,10毫秒 } //能落不 BOOL nengluo() { 	int lie; 	for (lie = 0;lie <10;lie++)//扫列如果到了19行有1就停止， 	{ 		if ( 1 == as[19][lie] ) 		{ 			MessageBeep(-1);//提示音，试验用 			return FALSE; 		} 	} 	return TRUE;//不能让快到19行停止的问题解决了，原因是我把返回1写到for循环里了。 }  void bsx() //变实心，也就是落到底就置2， { 	int hang, 		lie; 	for (hang = 20;hang>=0;hang--)//遍历所有行和列 	{ 		for (lie = 0;lie <10;lie++) 		{ 			if ( 1 == as[hang][lie] ) 			{ 				as[hang][lie] = 2;//调用时，如果确定不能落则置2， 			} 		} 	} } void xsshixin()//显示实心，把是2的块都画出来 { 	int hang, 		lie; 	for (hang = 20;hang>=0;hang--) 	{ 		for (lie = 0;lie <10;lie++) 		{ 			if ( 2 == as[hang][lie] ) 			{ 				SelectObject(hdc,GetStockObject(WHITE_PEN)); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 				SelectObject(hdc,CreateSolidBrush(RGB(255,255,0))); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 			} 		} 	} }

user: user-0
content: 我现在加注释，大神见谅。稍等。

user: user-5
content: 好长啊。。。。

user: user-6
content: 这么长，又没一个注释。。。

user: user-6
content: 我把格式调整一下吧 #include <windows.h> #include "resource.h" #define ID_TIMER 1 LRESULT CALLBACK kkk(HWND hwnd,UINT message,WPARAM wPARAM,LPARAM lParam); void CALLBACK TimerPro(HWND hwnd,UINT message,UINT TimerId,DWORD nTime); HDC hdc ; HWND hwnd ; HINSTANCE hins ;  void zaokuai(); //造块 void luokuai(); //落块 void yideweizhi(); //一的位置 void zuoyi(); //左移 void youyi(); //右移 void kuaisuluo(); //快速落 BOOL nengluo(); //能落不 void bsx(); //变实心 void xsshixin(); //显示实心  char as[20][10]= {     0  } ; int __stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR pCmdline,int nCmdShow) {     MSG msg ;     WNDCLASSEX cg ;     cg.cbClsExtra=0 ;     cg.cbWndExtra=0 ;     cg.cbSize=sizeof(WNDCLASSEX);     cg.hCursor=LoadCursor(NULL,MAKEINTRESOURCE(IDC_NO));     cg.hbrBackground=(HBRUSH)GetStockObject(WHITE_BRUSH);     cg.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1));     cg.hIconSm=NULL ;     cg.hInstance=hInstance ;     cg.lpfnWndProc=kkk ;     cg.lpszClassName="HAHAHA" ;     cg.lpszMenuName=NULL ;     cg.style=CS_HREDRAW|CS_VREDRAW ;               RegisterClassEx(&cg);     hwnd=CreateWindow("HAHAHA","俄罗斯",WS_OVERLAPPEDWINDOW,50,50,500,630+8,NULL,NULL,hInstance,NULL);     ShowWindow(hwnd,nCmdShow);     hins=hInstance ;     while(GetMessage(&msg,NULL,0,0))     {         TranslateMessage(&msg);         DispatchMessage(&msg);     }     return 0 ; }  LRESULT CALLBACK kkk(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) {     PAINTSTRUCT ps ;     switch(message)     {         case WM_PAINT :         hdc=BeginPaint(hwnd,&ps);         SelectObject(hdc,GetStockObject(GRAY_BRUSH));         Rectangle(hdc,0,0,300,600);         Rectangle(hdc,320,20,470,170);         zaokuai();         EndPaint(hwnd,&ps);         break ;         case WM_COMMAND :         switch(wParam)         {             case 1001 :             MessageBox(NULL,"游戏开始！","确认",MB_OK);             break ;         }         break ;         case WM_KEYDOWN :         switch(wParam)         {             case VK_LEFT :             zuoyi();             break ;             case VK_RIGHT :             youyi();             break ;             case VK_DOWN :             kuaisuluo();             break ;         }         break ;         case WM_CREATE :         yideweizhi();         SetTimer(hwnd,1,600,TimerPro);         CreateWindow("button","START",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,350,400,100,50,hwnd,(HMENU)1001,((LPCREATESTRUCT)lParam)->hInstance,NULL);         CreateWindow("static","分数：",WS_CHILD|WS_VISIBLE|SS_LEFT,350,190,45,30,hwnd,(HMENU)1002,((LPCREATESTRUCT)lParam)->hInstance,NULL);         CreateWindow("static","等级：",WS_CHILD|WS_VISIBLE|SS_LEFT,350,240,45,30,hwnd,(HMENU)1003,((LPCREATESTRUCT)lParam)->hInstance,NULL);         break ;         case WM_CLOSE :         PostQuitMessage(0);         KillTimer(hwnd,1);         KillTimer(hwnd,2);         break ;     }     return DefWindowProc(hwnd,message,wParam,lParam); } void CALLBACK TimerPro(HWND hwnd,UINT message,UINT TimerId,DWORD nTime) {     hdc=GetDC(hwnd);     SelectObject(hdc,GetStockObject(GRAY_BRUSH));     Rectangle(hdc,0,0,300,600);     Rectangle(hdc,320,20,470,170);     if(nengluo())     {         luokuai();     }     else      {         MessageBeep(-1);         bsx();     }     zaokuai();     xsshixin();     ReleaseDC(hwnd,hdc); } void zaokuai() {     int hang,     lie ;     char bs[10];     for(hang=0;hang<20;hang++)     {         for(lie=0;lie<10;lie++)         {             if(as[hang][lie])             {                 SelectObject(hdc,GetStockObject(WHITE_PEN));                 Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30);                 SelectObject(hdc,CreateSolidBrush(RGB(255,64,14)));                 Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30);                              }                      }     } }  void yideweizhi() {     as[0][3]=0 ;     as[0][4]=1 ;     as[0][5]=1 ;     as[0][6]=1 ;     as[1][3]=0 ;     as[1][4]=0 ;     as[1][5]=1 ;     as[1][6]=0 ;     as[2][3]=0 ;     as[2][4]=0 ;     as[2][5]=0 ;     as[2][6]=0 ;     as[3][3]=0 ;     as[3][4]=0 ;     as[3][5]=0 ;     as[3][6]=0 ; }  void luokuai() {     int hang,     lie ;     for(hang=18;hang>=0;hang--)     {         for(lie=0;lie<=10;lie++)         {             if(1==as[hang][lie])             {                 as[hang+1][lie]=1 ;                 as[hang][lie]=0 ;             }         }     } }  void zuoyi() {     int hang,     lie ;     for(hang=18;hang>=0;hang--)     {         for(lie=0;lie<10;lie++)         {             if(1==as[hang][lie])             {                 as[hang][lie-1]=1 ;                 as[hang][lie]=0 ;             }         }     } }  void youyi() {     int hang,     lie ;     for(hang=18;hang>=0;hang--)     {         for(lie=10;lie>=0;lie--)         {             if(1==as[hang][lie])             {                 as[hang][lie+1]=1 ;                 as[hang][lie]=0 ;             }         }     } }  void kuaisuluo() {     KillTimer(hwnd,1);     SetTimer(hwnd,2,10,TimerPro); }  BOOL nengluo() {     int lie ;     for(lie=0;lie<10;lie++)     {         if(1==as[19][lie])         {             MessageBeep(-1);             return FALSE ;         }         else          {             //MessageBeep(-1);             return TRUE ;         }     } }  void bsx() {     int hang,     lie ;     for(hang=20;hang>=0;hang--)     {         for(lie=0;lie<10;lie++)         {             if(1==as[hang][lie])             {                 as[hang][lie]=2 ;             }         }     } } void xsshixin() {     int hang,     lie ;     for(hang=20;hang>=0;hang--)     {         for(lie=0;lie<10;lie++)         {             if(2==as[hang][lie])             {                 SelectObject(hdc,GetStockObject(WHITE_PEN));                 Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30);                 SelectObject(hdc,CreateSolidBrush(RGB(255,255,0)));                 Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30);             }         }     } }

user: user-0
content: 我一开始贴代码发现格式乱了，所以贴的图片，代码如下 #include <windows.h> #include "resource.h" #define ID_TIMER 1 LRESULT CALLBACK kkk(HWND hwnd,UINT message,WPARAM wPARAM,LPARAM lParam); void CALLBACK TimerPro(HWND hwnd,UINT message,UINT TimerId,DWORD nTime); HDC hdc; HWND hwnd; HINSTANCE hins;  void zaokuai();//造块 void luokuai();//落块 void yideweizhi();//一的位置 void zuoyi();//左移 void youyi();//右移 void kuaisuluo();//快速落 BOOL nengluo();//能落不 void bsx();//变实心 void xsshixin();//显示实心  char as[20][10] = { 0 }; int __stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR pCmdline,int nCmdShow) { 	MSG msg; 	WNDCLASSEX cg; 	cg.cbClsExtra = 0; 	cg.cbWndExtra = 0; 	cg.cbSize = sizeof(WNDCLASSEX); 	cg.hCursor = LoadCursor(NULL,MAKEINTRESOURCE(IDC_NO)); 	cg.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 	cg.hIcon =LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICON1)); 	cg.hIconSm = NULL; 	cg.hInstance =hInstance; 	cg.lpfnWndProc = kkk; 	cg.lpszClassName = "HAHAHA"; 	cg.lpszMenuName = NULL; 	cg.style = CS_HREDRAW|CS_VREDRAW; 	  	RegisterClassEx(&cg); 	hwnd = CreateWindow("HAHAHA","俄罗斯",WS_OVERLAPPEDWINDOW,50,50,500,630+8,NULL,NULL,hInstance,NULL); 	ShowWindow(hwnd,nCmdShow); 	hins = hInstance; 	while(GetMessage(&msg,NULL,0,0)) 	{ 		TranslateMessage(&msg); 		DispatchMessage(&msg); 	} 	return 0; }  LRESULT CALLBACK kkk(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam) { 	PAINTSTRUCT ps; 	switch(message) 	{ 	case WM_PAINT: 		hdc = BeginPaint(hwnd,&ps); 		SelectObject(hdc,GetStockObject(GRAY_BRUSH)); 		Rectangle(hdc,0,0,300,600); 		Rectangle(hdc,320,20,470,170); 		zaokuai(); 		EndPaint(hwnd,&ps); 		break; 	case WM_COMMAND: 		switch(wParam) 		{ 		case 1001: 			MessageBox(NULL,"游戏开始！","确认",MB_OK); 			break; 		} 		break; 	case WM_KEYDOWN: 		switch(wParam) 		{ 		case VK_LEFT: 			zuoyi(); 			break; 		case VK_RIGHT: 			youyi(); 			break; 		case VK_DOWN: 			kuaisuluo(); 			break; 		} 		break; 	case WM_CREATE: 		yideweizhi(); 		SetTimer(hwnd,1,600,TimerPro); 		CreateWindow("button","START",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,350,400,100,50,hwnd,(HMENU)1001,((LPCREATESTRUCT) lParam)->hInstance,NULL); 		CreateWindow("static","分数：",WS_CHILD|WS_VISIBLE|SS_LEFT,350,190,45,30,hwnd,(HMENU)1002,((LPCREATESTRUCT) lParam)->hInstance,NULL); 		CreateWindow("static","等级：",WS_CHILD|WS_VISIBLE|SS_LEFT,350,240,45,30,hwnd,(HMENU)1003,((LPCREATESTRUCT) lParam)->hInstance,NULL); 		break; 	case WM_CLOSE: 		PostQuitMessage(0); 		KillTimer(hwnd,1); 		KillTimer(hwnd,2); 		break; 	} 	return DefWindowProc(hwnd,message,wParam,lParam); } void CALLBACK TimerPro(HWND hwnd,UINT message,UINT TimerId,DWORD nTime) { 	hdc = GetDC(hwnd); 	SelectObject(hdc,GetStockObject(GRAY_BRUSH)); 	Rectangle(hdc,0,0,300,600); 	Rectangle(hdc,320,20,470,170); 	if(nengluo()) 	{ 		luokuai();	 	} 	else 	{	MessageBeep(-1); 		bsx(); 	} 	zaokuai(); 	xsshixin(); 	ReleaseDC(hwnd,hdc); } void zaokuai() { 	int hang, 		lie; 	char bs[10]; 	for (hang = 0;hang<20;hang++) 	{ 		for (lie = 0;lie <10;lie++) 		{ 			if (as[hang][lie]) 			{ 				SelectObject(hdc,GetStockObject(WHITE_PEN)); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 				SelectObject(hdc,CreateSolidBrush(RGB(255,64,14))); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 				 			}							 			 		} 	} }  void yideweizhi() { 	as[0][3] = 0;as[0][4] = 1;as[0][5] = 1;as[0][6] = 1; 	as[1][3] = 0;as[1][4] = 0;as[1][5] = 1;as[1][6] = 0; 	as[2][3] = 0;as[2][4] = 0;as[2][5] = 0;as[2][6] = 0; 	as[3][3] = 0;as[3][4] = 0;as[3][5] = 0;as[3][6] = 0; }  void luokuai() { 	int hang, 		lie; 	for (hang = 18;hang>=0;hang--) 	{ 		for (lie = 0;lie <=10;lie++) 		{ 			if (1 == as[hang][lie]) 			{ 				as[hang+1][lie] = 1; 				as[hang][lie] = 0; 			} 		} 	} }  void zuoyi() { 	int hang, 		lie; 	for (hang = 18;hang>=0;hang--) 	{ 		for (lie = 0;lie <10;lie++) 		{ 			if (1 == as[hang][lie]) 			{ 				as[hang][lie-1] = 1; 				as[hang][lie] = 0; 			} 		} 	} }  void youyi() { 	int hang, 		lie; 	for (hang = 18;hang>=0;hang--) 	{ 		for (lie = 10;lie >=0;lie--) 		{ 			if (1 == as[hang][lie]) 			{ 				as[hang][lie+1] = 1; 				as[hang][lie] = 0; 			} 		} 	} }  void kuaisuluo() { 	KillTimer(hwnd,1); 	SetTimer(hwnd,2,10,TimerPro); }  BOOL nengluo() { 	int lie; 	for (lie = 0;lie <10;lie++) 	{ 		if ( 1 == as[19][lie] ) 		{ 			MessageBeep(-1); 			return FALSE; 		} 		else 		{			//MessageBeep(-1); 			return TRUE; 		} 	} }  void bsx() { 	int hang, 		lie; 	for (hang = 20;hang>=0;hang--) 	{ 		for (lie = 0;lie <10;lie++) 		{ 			if ( 1 == as[hang][lie] ) 			{ 				as[hang][lie] = 2; 			} 		} 	} } void xsshixin() { 	int hang, 		lie; 	for (hang = 20;hang>=0;hang--) 	{ 		for (lie = 0;lie <10;lie++) 		{ 			if ( 2 == as[hang][lie] ) 			{ 				SelectObject(hdc,GetStockObject(WHITE_PEN)); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 				SelectObject(hdc,CreateSolidBrush(RGB(255,255,0))); 				Rectangle(hdc,lie*30,hang*30,lie*30+30,hang*30+30); 			} 		} 	} }

user: user-7
content: 你直接上图片，我只好说，单步调试看看吧！图片看起来费劲，建议上代码

user: user-1
content: 代码功能归根结底不是别人帮自己看或讲解或注释出来的；而是被自己静下心来花足够长的时间和精力亲自动手单步或设断点或对执行到某步获得的中间结果显示或写到日志文件中一步一步分析出来的。 提醒：再牛×的老师也无法代替学生自己领悟和上厕所！ 单步调试和设断点调试（VS IDE中编译连接通过以后，按F10或F11键单步执行，按Shift+F11退出当前函数；在某行按F9设断点后按F5执行停在该断点处。）是程序员必须掌握的技能之一。