| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 384 人关注过本帖
标题:求大神精简一下 程序代码
只看楼主 加入收藏
lx1298474548
Rank: 1
等 级:新手上路
帖 子:12
专家分:0
注 册:2013-6-4
收藏
 问题点数:0 回复次数:0 
求大神精简一下 程序代码
#include "stdio.h"
#include "string.h"
#define PI  16
#define A 10
#define B 11
#define C 12
#define D 13
#define E 14
#define F 15
int z;
int abc(int a[10],int i)
{
    int c,d,w,v,t=0;
    for(v=0;v<=i;v++)
{
        if(1==v)
{
            d=a[v]*PI;

}
        if(v>1)
{
            w=PI*16; a[v]*=w; t+=a[v];
}
}

    return(d+t+a[0]);
}

void main()
{
i    nt a,b,c;
    int e[10];
    scanf("%d",&a);
    z=a;
    for(b=0;b<10;b++)
{
        e[b]=a%PI;
        a=a/PI;
        if(a<PI){e[++b]=a;break;}
}
    c=abc(e,b);
    for(;b>=0;b--)
{
        switch(e[b])
{
            case 0:e[b]='0';break;
            case 1:e[b]='1';break;
            case 2:e[b]='2';break;
            case 3:e[b]='3';break;
            case 4:e[b]='4';break;
            case 5:e[b]='5';break;
            case 6:e[b]='6';break;
            case 7:e[b]='7';break;
            case 8:e[b]='8';break;
            case 9:e[b]='9';break;
            case 10:e[b]='A';break;
            case 11:e[b]='B';break;
            case 12:e[b]='C';break;
            case 13:e[b]='D';break;
            case 14:e[b]='E';break;
            case 15:e[b]='F';break;
            default : break;

}
        printf("%c",e[b]);
}
    printf("\n校验结果%d",c);
    if(z==c)printf("结果是正确的!!!");
    else printf("结果不是正确的??");
}






#include "stdio.h"
#include "conio.h"
int map[15][15]={
1,1,0,1,0,0,0,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,};
int x=10,y=10,j,k;
int draw(int a,int b)
{
    int c=0;
    clrscr();
    for(j=0;j<15;j++)
    for(k=0;k<15;k++)
{
        if(map[j][k]==1)
{
i            f(a==j&&k==b)map[j][k]=0;
            gotoxy(j,k);
            printf("%c",'b');
            c+=map[j][k];
}
}
    return c;
}
void xy(int x,int y)
{
    gotoxy(x,y);
    printf("%c",'a');
}
void main()
{

    int a,l,v,c;
    while((a=getch())!='\n')
{
        switch(a)
{
            case 'w':y--;break;
            case 's':y++;break;
            case 'a':x--;break;
            case 'd':x++;break;
            default :  
                    printf("您按错了");
}
        v=x-1;
        c=y-1;
        l=draw(v,c);
        xy(v,c);
        if(l==0)break;
}
    printf("您胜利了");
大神精简一下 代码是有点乱
搜索更多相关主题的帖子: include return 
2013-06-30 23:20
快速回复:求大神精简一下 程序代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.047858 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved