資源簡介
C++實戰源碼-如何使用嵌套結構(入門級實例081).zip
代碼片段和文件信息
//?nest.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“iostream.h“
#include?“string.h“
struct?Date
{
int?monthdayyear;//年月日
};
struct?Student //學生信息
{
long?int?num; //學號
char?name[20]; //姓名
char?sex[4]; //性別
char?addr[20]; //地址
Date?birthDate; //出生日期
};
int?main(int?argc?char*?argv[])
{
Student?s1?=?{1002“張三““男““北京“{5161981}};
//輸出學生信息
cout?<“學號:“?< <“姓名:“?< <“性別:“?< <“地址:“?< <“出生日期:“?< < s1.birthDate.day?<“\n“;
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????733??2010-07-02?10:59??nest\nest.cpp
?????文件????????4512??2010-07-02?10:32??nest\nest.dsp
?????文件?????????533??2010-07-02?10:32??nest\nest.dsw
?????文件?????????291??2010-07-02?10:32??nest\StdAfx.cpp
?????文件?????????769??2010-07-02?10:32??nest\StdAfx.h
- 上一篇:C++實戰源碼-策略模式的簡單應用
- 下一篇:C++實戰源碼-燈塔數量
評論
共有 條評論