#include <iostream>                                       //数据流输入输出
#include <stdlib.h>                                       //定义杂项函数及内存分配函数
using namespace std;
int main()
{
int a,b;                                          //先定义后赋值
a = 32760;                                          //赋值
b = 60;         
long c = 123456789,d = 123;                        //边定义边赋值
double x = 1.23, y = 2.0;                            //双精度型
char c1 =  65 ,c2 = 97;                            //单字符型
cout << "\na + b = " << a + b;
cout << "\na + b = " << (long)a + b;            //将a强制类型转换为长整型
cout << "\nx*y = " << x * y ;
cout << "\nc1 = " << c1 << " c2 = " << c2;
system("pause");                             //暂停
return 0;                                    //返回值
}
1>hello.cpp
1>c:\users\lenovo\documents\visual studio 2008\projects\hello\hello\hello.cpp(9) : error C2065: “a”: 未声明的标识符
1>c:\users\lenovo\documents\visual studio 2008\projects\hello\hello\hello.cpp(10) : error C2065: “b”: 未声明的标识符
1>c:\users\lenovo\documents\visual studio 2008\projects\hello\hello\hello.cpp(14) : error C2065: “a”: 未声明的标识符
1>c:\users\lenovo\documents\visual studio 2008\projects\hello\hello\hello.cpp(14) : error C2065: “b”: 未声明的标识符
1>c:\users\lenovo\documents\visual studio 2008\projects\hello\hello\hello.cpp(15) : error C2065: “a”: 未声明的标识符
1>c:\users\lenovo\documents\visual studio 2008\projects\hello\hello\hello.cpp(15) : error C2065: “b”: 未声明的标识符
1>生成日志保存在“file://c:\Users\lenovo\Documents\Visual Studio 2008\Projects\hello\hello\Debug\BuildLog.htm”
1>hello - 6 个错误,0 个警告