搜索
查看: 960|回复: 13
打印 上一主题 下一主题

[原创] 打飞机源代码(请先下载后再打开此页)

[复制链接]
跳转到指定楼层
楼主
发表于 2017-12-21 18:47:19 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖为密码帖 ,请输入密码 
来自 2#
 楼主| 发表于 2017-12-21 19:03:44 | 只看该作者
推荐
发表于 2017-12-23 12:26:05 | 只看该作者
密码是cwcyarr            

点评

不过请别暴露。  发表于 2017-12-23 14:36
推荐
发表于 2018-1-13 09:40:32 | 只看该作者
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
int main()
{
        char a[15][15]={"         ",
                                    "         ",
                    "         ",
                    "         ",
                    "         ",
                    "         ",
                    "         ",
                    "         ",
                    "         ",
                    "    W    ",
                                   };
    int sj[3],i,score=0,zb=4;
    int life=1,jc=0,s=8,sum=0,m=0;
    int rzb;
    while(life!=0)
    {
        if(GetKeyState('0')<0)
        {
                        break;
        }                
        srand(time(NULL));
        for(i=0;i<3;i++)
                        sj[i]=rand()%10;
        a[0][sj[0]]='v';
        a[0][sj[1]]='v';
        a[0][sj[2]]='v';
        Sleep(380);
        system("cls");
        for(i=0;i<=9;i++)
                        puts(a[i]);
        printf("Your score:%d",score);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                //MessageBox(NULL,"←键"," ",MB_OK);
                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }      
            //getch();     
        }
        Sleep(5);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }  
            //getch();         
        }
        Sleep(5);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }  
            //getch();         
        }
        Sleep(5);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }  
            //getch();         
        }
        Sleep(5);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }  
            //getch();         
        }
        Sleep(5);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }  
            //getch();         
        }
        Sleep(5);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }  
            //getch();         
        }
        Sleep(5);
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }  
            //getch();         
        }
               
        if(a[0][zb]=='v' || a[1][zb]=='v' || a[2][zb]=='v' || a[3][zb]=='v' || a[4][zb]=='v' || a[5][zb]=='v' || a[6][zb]=='v' || a[7][zb]=='v'/* || a[8][zb]=='v'*/)   
        {
                        rzb=zb;
            while(jc==0)
            {
                                s--;
                if(a[s][rzb]=='v')
                {
                                        a[s][rzb]=' ';
                    jc=1;
                    score++;
                }
                else
                {
                                        a[s][rzb]='|';
                    Sleep(1);
                    sum++;
                }
                            
               
        if(GetKeyState(VK_LEFT)<0 || GetKeyState(VK_RIGHT)<0)
        {
                        if(GetKeyState(VK_LEFT)<0)
            {
                                if(zb-1>=0)
                {
                                        zb--;
                                        a[9][zb+1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
                        if(GetKeyState(VK_RIGHT)<0)
            {
                                if(zb+1<=8)
                {
                                        zb++;
                                        a[9][zb-1]=' ';
                                        a[9][zb]='W';
                                        system("cls");
                                        for(i=0;i<=9;i++)
                                                puts(a[i]);
                    printf("Your score:%d",score);
                }        
            }
            //getch();         
        }               
               
               
                system("cls");
                                for(i=0;i<=9;i++)
                                        puts(a[i]);
                printf("Your score:%d",score);               
            }
            jc=0;
            while(sum!=0)
            {
                                a[m][rzb]=' ';
                m--;
                sum--;
            }
            m=7;
            s=9;
        }
        if(a[8][zb]=='v')
        {
            life=0;
                        for(i=0;i<9;i++)
                        {
                                if(a[8][i]=='v')
                                        a[9][i]='v';
                                a[8][i]=' ';
                        }
                        for(i=0;i<9;i++)
                        {
                                if(a[7][i]=='v')
                                        a[8][i]='v';
                                a[7][i]=' ';
                        }
                        for(i=0;i<9;i++)
                        {
                                if(a[6][i]=='v')
                                        a[7][i]='v';
                                a[6][i]=' ';
                        }
                        for(i=0;i<9;i++)
                        {
                                if(a[5][i]=='v')
                                        a[6][i]='v';
                                a[5][i]=' ';
                        }   
                        for(i=0;i<9;i++)
                        {
                                if(a[4][i]=='v')
                                        a[5][i]='v';
                                a[4][i]=' ';
                        }
                        for(i=0;i<9;i++)
                        {
                                if(a[3][i]=='v')
                                        a[4][i]='v';
                                a[3][i]=' ';
                        }                              
                        for(i=0;i<9;i++)
                        {
                                if(a[2][i]=='v')
                                        a[3][i]='v';
                                a[2][i]=' ';
                        }     
                        for(i=0;i<9;i++)
                        {
                                if(a[1][i]=='v')
                                        a[2][i]='v';
                                a[1][i]=' ';
                        }
                        for(i=0;i<9;i++)
                        {
                                if(a[0][i]=='v')
                                        a[1][i]='v';
                                a[0][i]=' ';
                        }
                        for(i=0;i<9;i++)
                        {
                                a[9][i]=' ';
                        }
            a[9][zb]='X';                                         
            system("cls");
                        for(i=0;i<=9;i++)
                                puts(a[i]);
            printf(" Game Over!!\nYour score: %d",score);
            if(score>=66)
            {
                                printf("\n Get password: cwcyarr");
                Sleep(7500);
            }
            Sleep(2500);           
            continue;
        }        
        for(i=0;i<9;i++)
        {
                        if(a[8][i]=='v')
                                a[9][i]='v';
            a[8][i]=' ';
        }                  
        for(i=0;i<9;i++)
        {
                        if(a[7][i]=='v')
                                a[8][i]='v';
            a[7][i]=' ';
        }
        for(i=0;i<9;i++)
        {
                        if(a[6][i]=='v')
                                a[7][i]='v';
            a[6][i]=' ';
        }
        for(i=0;i<9;i++)
        {
                        if(a[5][i]=='v')
                                a[6][i]='v';
            a[5][i]=' ';
        }   
        for(i=0;i<9;i++)
        {
                        if(a[4][i]=='v')
                                a[5][i]='v';
            a[4][i]=' ';
        }
        for(i=0;i<9;i++)
        {
                        if(a[3][i]=='v')
                                a[4][i]='v';
            a[3][i]=' ';
        }                              
        for(i=0;i<9;i++)
        {
                        if(a[2][i]=='v')
                                a[3][i]='v';
            a[2][i]=' ';
        }     
        for(i=0;i<9;i++)
        {
                        if(a[1][i]=='v')
                                a[2][i]='v';
            a[1][i]=' ';
        }
        for(i=0;i<9;i++)
        {
                        if(a[0][i]=='v')
                                a[1][i]='v';
            a[0][i]=' ';
        }
        for(i=0;i<9;i++)
        {
            a[9][i]=' ';
        }
        a[9][zb]='W';
    }
    system("cls");
    /*for(i=0;i<=9;i++)
                puts(a[i]);*/
    printf("\n\n\n            Your score:%d",score);
    if(score>=66)
    {
                printf("\n       Get password: cwcyarr");
        Sleep(7500);
    }
        getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
        getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
        getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
    getch();getch();getch();getch();getch();getch();getch();getch();getch();getch();
        return 0;
}

点评

这就晒代码了?又不是你的。  发表于 2018-1-13 14:07
推荐
发表于 2018-2-12 12:25:54 | 只看该作者
讲真,好一个大大的mian啊,可以考虑用下函数嘛
板凳
发表于 2017-12-21 22:26:47 | 只看该作者
看看哪来的 BUG。

点评

BUG 满天飞。  发表于 2017-12-23 14:39
5#
发表于 2017-12-23 14:37:45 | 只看该作者
这样好玩吗?

天!.png (267.97 KB, 下载次数: 19)

好玩?

好玩?

点评

足足 180 个 getch(); 耶~  发表于 2017-12-23 14:39
6#
发表于 2018-1-13 09:39:14 | 只看该作者
卧槽。。。。。。。。。。。。。。。。。。。。。。。。。
8#
 楼主| 发表于 2018-1-20 17:02:59 来自手机 | 只看该作者
陈运123 发表于 2018-1-13 09:40
#include
#include
#include

你**************************

点评

楼主表示很生气!  发表于 2018-1-29 18:39
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

广播台
特别关注
快速回复 返回顶部 返回列表