C语言高手进来。改错题。

2024-11-22 00:33:25
推荐回答(5个)
回答1:

#include
void main()
{
char b[17]={"0123456789ABCDEF"};
int c[64],d,i=0,base=16;
long n;
printf("Enter a number:\n"); scanf("%ld",&n);
do
{
c[i]=n%base;i++;n=n/base;
}while(n!=0);
printf("Transmite new base:\n");
for(;i>=0;--i)
{
d=c[i];printf("%c",b[d]);
}
printf("\n");
}

回答2:

#include
main()
{ char b[17]={"0123456789ABCDEF"};
int c[64],d,i=0,base=16;
long n;
printf("Enter a number:\n"); scanf("%ld",&n);
do {
c[i]=n%16;i++;n=n/base;}
while(n!=0);
printf("Transmite new base:\n");
for(i--;i>=0;--i)
{ d=c[i];printf("%c",b[d]); }
printf("\n");
}

回答3:

#include
#define max 100
void main()
{int i=0;
char c[max];
long n;
printf("Enter a number:\n");
scanf("%ld",&n);
do{
c[i]=n%16;i++;n=n/16;
}while(n!=0);
printf("Transmite new base:\n");
for(;i>=0;--i){
swicth(i){
case 1:
case 2:
case 1:
printf("%c",b[d]);

printf("\n");
}

回答4:

偶忘的差不多了。。。

回答5:

wo yun 我学VB 就够呛了