#include <stdio.h>
int main()
{
int age = 15;
int height = 162;
double weight = 82.50000;
char isfat = 'y';
printf("年龄:15 岁\n", age);
printf("身高:162 CM\n", height);
printf("体重:82.50000 KG\n", weight);
printf("是否属于肥胖儿童:y\n", isfat);
return 0;
}
这是哪里出错了?大神能说明白一点吗?说得太深奥的话,我可能看不明白
#include <stdio.h> int main() { int age = 15; int height = 162; double weight = 82.50000; char isfat = 'y'; printf("年龄:15 岁\n", age); printf("身高:162 CM\n", height); printf("体重:%f\n", weight); printf("是否属于肥胖儿童:%c\n", isfat); return 0; }
#include <stdio.h> int main() { int age = 15; int height = 162; float weight = 82.5; char isfat = 'y'; printf("年龄:%d 岁\n", age); printf("身高:%d CM\n", height); printf("体重:%f KG\n", weight); printf("是否属于肥胖儿童:%c\n", isfat); /*%d,%f,%c此类符号在后面会有讲解*/ return 0; }
printf 函数中%分百号为转义字符(如果在输出中用作除号)
输入需要参考格式化字符如下