oqiu
2017-05-14 12:20
反复对了几次,还是没发现哪里错
int age=15; int height=162; float weight=82..5; char isfat='y'; 还有后缀最好改为.c
定义变量的时候没有声明变量的类型如int,float等等
#include <stdio.h>
int main()
{
int age = 15, height = 162;//定义整形的数据类型:年龄和身高,并赋值;
float weight = 82.5;//定义单精度数据类型:体重;
char isfat = 'y';//定义字符型 ‘isfat’;
printf("年龄:%d\n",age);
printf("身高:%d\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);
return 0;
}
C语言入门
926210 学习 · 20797 问题
相似问题