#include"stdio.h"
main() {printf("I love music!\n");printf("the music is \"D:\\music\\love.mp3\".\n");}
#include "stdio.h" #define PI 3.14 //符号常量 main() {float r,area; //定义变量 r=1.5; //赋值 area=PI*r*r; //计算语句 printf("area=%f\n",area); //输出结果 }
#include "stdio.h"
main()
{int x,y,z;x=2;y=3;z=x+y;printf("x+y=%d\n",z);}
#include "stdio.h"
main() {float r=1.5,pi,area; pi=3.14; area=pi*r*r;printf("area=%f\n",area); }
#include "stdio.h"
main() {int m;char c;m='A'; //字符赋值给整型变量 c=66; //整数赋值给字符变量printf("%c,%d\n",m,m);printf("%c,%d\n",c,c); }
#include "stdio.h"
main() {int i=2; float f=1.5;double d=4.0;long e=2;printf(“i*f=%f,i转化为float类型参与运算",i*f);printf(“d/e=%lf,e转化为double类型参与运算",d/e);printf("10+'a'=%d,'a'转化为int类型参与运算",10+'a');printf("10+'a'+i*f=%f,int转化为float类型",10+'a'+i*f);printf("10+'a'+i*f-d/e=%lf,float转化为double类型",10+'a'+i*f-d/e); }
#include "stdio.h"
main() {float f;f=9.8;printf("(int)f=%d,f=%f\n",(int)f,f);}