bec666 2019-09-22 18:04 采纳率: 88%
浏览 317
已结题

已经换了输入法,在运行中移动键asdw总是变成中文拼音格式,程序结束之后又可以改回来,求解决方法?

图片说明

#include<graphics.h>
#include<stdio.h>
#include<conio.h>
#include<windows.h>
main()
{
    int a[100],b[100],c,d,e[2]={10,0},f=0,g[2],i=0;
    char h[2]={d};
    a[0]=50;
    a[1]=60;
    a[2]=70;
    a[3]=80;
    b[0]=20;
    b[1]=20;
    b[2]=20;
    b[3]=20;
    c=3;
    initgraph(500,500);
    while(1)
    {
        if(f==0)
        {
            g[0]=10*(rand()%50);
            g[1]=10*(rand()%50);
            f=1;
        }
        fillrectangle(g[0],g[1],g[0]+5,g[1]+5);
        if(kbhit())
        {
            h[1]=h[0];
            h[0]=getch();
        }
    rectangle(0,0,500,500);
        if(h[0]=='A'&&h[1]!='D')
        {
            e[0]=-10;
            e[1]=0;
        }
        if(h[0]=='S'&&h[1]!='W')
        {
            e[0]=0;
            e[1]=10;
        }
        if(h[0]=='D'&&h[1]!='A')
        {
            e[0]=10;
            e[1]=0;
        }
        if(h[0]=='W'&&h[1]!='S')
        {
            e[0]=0;
            e[1]=-10;
        }
        for(d=0;d<c;d++)
        {
                a[d]=a[d+1];
                b[d]=b[d+1];
        }
        if(a[c]+e[0]!=g[0]||b[c]+e[1]!=g[1])
        {
        a[c]+=e[0];
        b[c]+=e[1];
        }
        if(a[c]+e[0]==g[0]&&b[c]+e[1]==g[1])
        {
            a[c+1]=g[0];
            b[c+1]=g[1];
            f=0;
            c++;
        }
        if(a[c]==510||b[c]==510||a[c]==-10||b[c]==-10)
            break;
        for(d=0;d<c;d++)
        {
            if(a[c]==a[d]&&b[c]==b[d])
            {
                i=1;
                break;
            }
        }
        if(i==1)
            break;
        for(d=0;d<=c;d++)
        {
            fillrectangle(a[d],b[d],a[d]+5,b[d]+5);
        }
        Sleep(100);
        cleardevice();
        continue;
    }
    printf("生活如此艰难\n你长到了%d米",c+1);
} 
  • 写回答

3条回答 默认 最新

  • threenewbee 2019-09-22 18:58
    关注

    和你的输入法冲突,百度这种山寨的输入法软件存在很多问题,在运行的时候切换到英文输入法状态,或者卸载百度输入法,使用默认的微软拼音就可以了。

    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler