2017 資訊之芽 C 語法班
一個人可能有好多屬性
struct person {
string name;
string gender;
int age;
int height;
int weight;
};
結尾必須有分號!
person A;
A.name = "Billy"
A.age = 42;
"." 代表存取成員變數
person people[100];
people[0].name = "Billy";
struct dept {
char name[100];
int college;
person students[100];
person professors[100];
};
struct university {
char name[100];
dept depts[100];
};
university NTU;
university DYU;
NTU = DYU;
struct dept {
dept(): name("Philosophy"), college(1) {}
string name;
int college;
person students[100];
person professors[100];
};