1、模块1
在main.cpp里输入程序如下:
#include "stdio.h" //使能printf()函数
#include <stdlib.h> //使能exit();
#include "Data_type.h"
//argc 是指命令行输入参数的个数;
//argv[]存储了所有的命令行参数;
//argv[0]通常指向程序中的可执行文件的文件名。在有些版本的编译器中还包括程序文件所在的路径。
//如:"d:\Production\Software\VC++_2005_Test\Win32控制台应用程序\Vc++_Test\debug\Vc++_Test.exe"
int main(int argc,char *argv[])
{
int i;
for(i=0;i<argc;i++)
{
printf("Argument %d is %s.\n", i, argv[i]);
}
Data_Type_test();
exit(0); //注意:return是退出當前函數exit是退出當前程序。
}
2、模块2
在Data_Type.cpp里输入程序如下:
#include "stdio.h" //使能printf()函数
void Data_Type_test()
{
printf( "int type data length is %d\n",sizeof(int) );
printf( "float type data length is %d\n",sizeof(float) );
printf( "double type data length is %d\n",sizeof(double) );
printf( "unsigned char type data length is %d\n",sizeof(unsigned char) );
printf( "char type data length is %d\n",sizeof(char) );
printf( "short type data length is %d\n",sizeof(short) );
printf( "short int type data length is %d\n",sizeof(short int) );
printf( "signed short type data length is %d\n",sizeof(signed short) );
printf( "signed hort int type data length is %d\n",sizeof(signed short int) );
printf( "unsigned short type data length is %d\n",sizeof(unsigned short) );
printf( "unsigned hort int type data length is %d\n",sizeof(unsigned short int) );
printf( "signed int type data length is %d\n",sizeof(signed int) );
printf( "signed type data length is %d\n",sizeof(signed) );
printf( "unsigned int type data length is %d\n",sizeof(unsigned int) );
printf( "unsigned type data length is %d\n",sizeof(unsigned) );
printf( "long type data length is %d\n",sizeof(long) );
printf( "long int type data length is %d\n",sizeof(long int) );
printf( "signed long type data length is %d\n",sizeof(signed long) );
printf( "signed long int type data length is %d\n",sizeof(signed long int) );
printf( "unsigned long type data length is %d\n",sizeof(unsigned long) );
printf( "unsigned long int type data length is %d\n",sizeof(unsigned long int) );
printf( "bool type data length is %d\n",sizeof(bool) );
}
3、模块3
在Data_Type.h里输入程序如下:
extern void Data_Type_test();