程序编写环境:
编辑器:UltraEdit18编译器:g++4.4.3、gcc4.4.3编译环境:ubuntu10.0
作业练习:
简单的C++结构体嵌套的使用,以及结构体大小和空结构体,使用g++编译
#include
//cout
#include
#define NSIZE 128
using namespace std;
struct SubStruct
{
char *str;
double dVal;
};
#if 0
struct MyStruct
{
void Hello();
int ID;
char *name;
struct SubStruct sub;
};
#endif //0
typedef struct MyStruct
{
void Hello();
int ID;
char *name;
struct SubStruct sub;
}mystruct;
void MyStruct::Hello()
{
cout << "hello struct, nice to me you!" << endl;
cout << "my name is:" << name << '\t' << &#