#include <stdio.h>
int main()
{
char c = 'a';
int n = c ; //将c赋值给n
float f = c ; //将c赋值给f
double d = c ; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
#include <stdio.h>
int main()
{
char c = 'a'
int n = c;
float f = n;
double d = f;
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
把a改成97 f=97.000000
把字母c和;之间的空格消除试试 我试了试可以
因为97在ASCII码表上是‘a’
#include <stdio.h>
int main()
{
char c = 'a';
int n = c; //将c赋值给n
float f = c; //将c赋值给f
double d = c; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
这是我的代码
你要解决的问题是什么?我不是很明白,输出没问题呀(结果:97;97.000000;97.000000(软件:c-Free5.0))