C语言-数据类型在LR中的应用
2016-09-07 10:49
176 查看
计算矩形和圆形面积
#define PI 3.1415
Action()
{
int Area;//定义矩形面积
int length=10,width=10;//定义一个矩形的长和宽
float r=4.5,s;//定义两个不同半径的圆s和s1
double r1=34.81,s1;
char x='z';//定义单独字符x
Area=length*width;//计算矩形面积
s=PI*r*r;//计算不同半径圆的面积
s1=PI*r1*r1;
lr_output_message("面积为:%d(十进制)",Area);//输出矩形面积
lr_output_message("面积为:%o(八进制)",Area);
lr_output_message("面积为:%x(十六进制)",Area);
lr_output_message("\n");//换行
lr_output_message("半径为%.f(四舍五入取整数)的面积为:%f",r,s);//输出圆形面积
lr_output_message("半径为%.f的面积为:%.3f(保留3位小数)",r1,s1);
lr_output_message("/n");
lr_output_message("char常量字符表示为:%c",x);
lr_output_message("char常量字符用整数:%d",x);
lr_output_message("/n");
lr_output_message("Area占用字节大小为:%d",sizeof(Area));
return 0;
}
运行结果:
#define PI 3.1415
Action()
{
int Area;//定义矩形面积
int length=10,width=10;//定义一个矩形的长和宽
float r=4.5,s;//定义两个不同半径的圆s和s1
double r1=34.81,s1;
char x='z';//定义单独字符x
Area=length*width;//计算矩形面积
s=PI*r*r;//计算不同半径圆的面积
s1=PI*r1*r1;
lr_output_message("面积为:%d(十进制)",Area);//输出矩形面积
lr_output_message("面积为:%o(八进制)",Area);
lr_output_message("面积为:%x(十六进制)",Area);
lr_output_message("\n");//换行
lr_output_message("半径为%.f(四舍五入取整数)的面积为:%f",r,s);//输出圆形面积
lr_output_message("半径为%.f的面积为:%.3f(保留3位小数)",r1,s1);
lr_output_message("/n");
lr_output_message("char常量字符表示为:%c",x);
lr_output_message("char常量字符用整数:%d",x);
lr_output_message("/n");
lr_output_message("Area占用字节大小为:%d",sizeof(Area));
return 0;
}
运行结果:
相关文章推荐
- C语言 第二讲 数据类型
- C语言一些基础:数据类型,运算类型及表达式
- C语言的输入输出的数据类型与所用格式说明符不一致(2)
- 浅析J2EE应用中的时间值字段的数据类型(转3)
- 浅析J2EE应用中的时间值字段的数据类型(转2)
- C语言中的数据类型在VB中的申明
- 嵌入式系统开发人员C语言测试题--填空题(数据类型和变量)
- .NET 2.0里强类型数据创建多层应用
- C语言应用:将128位二进制数据转换为十六进制输出
- 浅析J2EE应用中的时间值字段的数据类型(转5)
- (C语言教程)第二章: 数据类型、运算符、表达式
- COM组件设计与应用3 - 数据类型
- C语言之数据类型
- ODAC 应用技巧 (二)使用 BLOB 及 CLOB 数据类型
- java学习笔记(二) ----基本数据类型应用
- c语言课件,数据类型(续)
- COM 组件设计与应用之数据类型
- .NET 2.0里强类型数据创建多层应用
- 嵌入式系统开发人员C语言测试题--填空题(数据类型和变量)
- Extraction应用构建平台应用基础(八)------数据类型和Java对象的映射关系篇