/*
此代码在C++ Builder下编译通过
常量可以定义变量整型,字符串,字符表达式,等等,
需要注意的是:
如果用符号#define来定义结尾不能加”;";而如果用
constP定义常量就必须加上‘;'
*/
#include <stdio.h>
#define A 19
#define F 14.0
#define STR "baizengfei"
#define B 'B'
void main()
{
const a = 29;
const f =24.0;
const str = "baizengfei";
const b = 'b';
printf("A = %d\n",A);
printf("F = %f\n",F);
printf("STR = %s\n",STR);
printf("B = %c\n",B);
printf("a = %d\n",a);
printf("f = %f\n",f);
printf("str = %s\n",str);
printf("b = %c\n",b);
system("pause");
/*
system() //在vc++6.0当中使用的库文件为: process.h
此处的system("pause")是因为在C++Builder中如果不加这句程序就一闪而结束、
当然也可以加个getchar();
*/
return;
}
/* -------------运行结果------------
A = 19
F = 14.000000
STR = baizengfei
B = B
a = 29
f = 24.000000
str = baizengfei
b = b
请按任意键继续. . .
*/