From e1cae3d9d41edfd5ce1006dec8d6fab878f39163 Mon Sep 17 00:00:00 2001 From: "18408000302@stu.hut.edu.cn" <18408000302@stu.hut.edu.cn> Date: Fri, 11 Jan 2019 14:55:12 +0800 Subject: [PATCH] se commit --- 文件(1).c => 文件(2).c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) rename 文件(1).c => 文件(2).c (97%) diff --git a/文件(1).c b/文件(2).c similarity index 97% rename from 文件(1).c rename to 文件(2).c index f46969a..73edbeb 100644 --- a/文件(1).c +++ b/文件(2).c @@ -69,13 +69,17 @@ void startgame() // scanf("%d%d",&x,&y); while(1) { - if(strcmp(p[x][y]," ")==0)//ÅжÏÆåÅÌλÖÃÊÇ·ñÒÑÓÐÆå×Ó + if(x>=0&&x<=18&&y>=0&&y<=18) + { + if(strcmp(p[x][y]," ")==0)//ÅжÏÆåÅÌλÖÃÊÇ·ñÒÑÓÐÆå×Ó { strcpy(p[x][y],"¡ñ");//ûÓÐÔòϺÚÆå break; } else printf(" Äú²»ÄÜÔÚ´ËλÖÃÂä×Ó£¬ÇëÖØÐÂÊäÈë×ø±ê£º");//ÒÑÓÐÆå×ÓÔòÌáʾÓû§ÖØÐÂÂä×Ó + } + else printf(" ÊäÈëµÄ×ø±ê³¬¹ýÁËÆåÅÌ·¶Î§"); scanf("%d%d",&x,&y); } system("cls"); @@ -101,13 +105,17 @@ void white() // scanf("%d%d",&x,&y); while(1) { - if(strcmp(p[x][y]," ")==0)//ÅжϴËλÖÃÊÇ·ñÓÐÆå + if(x>=0&&x<=18&&y>=0&&y<=18) + { + if(strcmp(p[x][y]," ")==0)//ÅжÏÆåÅÌλÖÃÊÇ·ñÒÑÓÐÆå×Ó { - strcpy(p[x][y],"¡ð");//ûÓÐÔòÏ°×Æå + strcpy(p[x][y],"¡ð");//ûÓÐÔòϺÚÆå break; } else - printf(" Äú²»ÄÜÔÚ´ËλÖÃÂä×Ó£¬ÇëÖØÐÂÊäÈë×ø±ê£º");//ÓÐÆåÔòÌáʾÖØÐÂÊäÈë + printf(" Äú²»ÄÜÔÚ´ËλÖÃÂä×Ó£¬ÇëÖØÐÂÊäÈë×ø±ê£º");//ÒÑÓÐÆå×ÓÔòÌáʾÓû§ÖØÐÂÂä×Ó + } + else printf(" ÊäÈëµÄ×ø±ê³¬¹ýÁËÆåÅÌ·¶Î§"); scanf("%d%d",&x,&y); } system("cls");