C语言填空题 把从键盘上输入的十进制数(long型)以二进制~十六进制任一制式的形式输出#include main(){ char b[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',};int c[64],d,i=0,base;long n;printf("e
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 11:24:57
C语言填空题 把从键盘上输入的十进制数(long型)以二进制~十六进制任一制式的形式输出#include main(){ char b[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',};int c[64],d,i=0,base;long n;printf("e
C语言填空题
把从键盘上输入的十进制数(long型)以二进制~十六进制任一制式的形式输出
#include
main()
{ char b[]={'0','1','2','3','4','5','6','7','8','9',
'A','B','C','D','E','F',};
int c[64],d,i=0,base;
long n;
printf("enter a number :\n"); scanf("%ld",&n);
printf("enter new base :\n"); scanf("%d",&base);
do
{ c[i]= ;
i++;
n= ;
} while ( );
printf("transmite new base:\n");
for (--i;i>=0;--i)
{ d=c[i];
printf("%c",b[d]);
}
printf("\n");
}
程序运行后的结果是0 1 1 8,请填写适当的符号或语句
void main()
{
char s[]="12345678"; int v[4]={0,1,1,0},k,i;
for (k=0; s[k];k++)
{
switch ( )
{
case'1':i=0;
case'2':i=1;
case'3':i=2;
case'4':i=3;
}
;
}
for(k=0;k
C语言填空题 把从键盘上输入的十进制数(long型)以二进制~十六进制任一制式的形式输出#include main(){ char b[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',};int c[64],d,i=0,base;long n;printf("e
强烈的犯罪感
第一题
#include
main()
{ char b[]={'0','1','2','3','4','5','6','7','8','9',
'A','B','C','D','E','F',};
int c[64],d,i=0,base;
long n;
printf("enter a number :\n"); scanf("%ld",&n);
printf("enter new base :\n"); scanf("%d",&base);
do
{ c[i]= n%base ;
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");
}
第二题
#include
void main()
{
char s[]="12345678"; int v[4]={0,1,1,0},k,i;
for (k=0; s[k];k++)
{
switch ( s[k] )
{
case'1':i=0;
case'2':i=1;
case'3':i=2;
case'4':i=3;
}
v[i]=s[k]-'0';
}
for(k=0;k