/****Lession1.h****/
extern bool a;
extern int b;
extern float c;
extern double d;
extern unsigned int e;
extern long f;
extern unsigned long g;
extern char h;
extern long double i;
/****Lession1.cpp****/
#include "stdafx.h"
#include "Lession1.h"
bool a;
int b;
float c;
double d;
unsigned int e;
long f;
unsigned long g;
char h;
long double i;
/****Test.cpp****/
#include "stdafx.h"
#include <iostream>
#include "Lession1.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int b=2;
::a = true;
::b = 1;
::c = float();
::d = double();
::e = unsigned int();
::f = long();
::g = unsigned long();
::h = char();
::i = long double();
cout<<"全局变量 b="<<::b<<endl;
cout<<"局部变量 b="<<b<<endl;
cout<<"bool 所占字节数:"<<sizeof(a)<<endl;
cout<<"int 所占字节数:"<<sizeof(b)<<endl;
cout<<"float 所占字节数:"<<sizeof(c)<<endl;
cout<<"double 所占字节数:"<<sizeof(d)<<endl;
cout<<"unsigned int 所占字节数:"<<sizeof(e)<<endl;
cout<<"long 所占字节数:"<<sizeof(f)<<endl;
cout<<"unsigned long 所占字节数:"<<sizeof(g)<<endl;
cout<<"char 所占字节数:"<<sizeof(h)<<endl;
cout<<"long double 所占字节数:"<<sizeof(i)<<endl;
}