#include < stdio.h>
#include < stdlib.h>
#include < string.h>
struct phone {
char phone1[10];
char phone2[10];
};
struct label {
char name[20];
int age;
struct phone callno;
};
void showlabel(struct label *ptr) {
printf("員工名牌----------\n");
printf("姓名: %s\n",ptr->name);
printf("年齡: %d\n",ptr->age);
printf("電話1: %s\n",ptr->callno.phone1);
printf("電話2: %s\n",ptr->callno.phone2);
printf("------------------\n");
}
int main() {
struct label worker;
struct label *ptr;
ptr = &worker;
strcpy(worker.name, "陳會安");
ptr->age = 30;
strcpy(ptr->callno.phone1,"244668800");
strcpy(ptr->callno.phone2,"133557799");
strcpy(worker.name,"陳會安");
printf("姓名: %s\n",worker.name);
printf("年齡: %d\n",worker.age);
printf("電話1: %s\n",worker.callno.phone1);
printf("電話2: %s\n",worker.callno.phone2);
showlabel(ptr);
system("PAUSE");
return 0;
}
評分: ★★★★▲
回覆刪除Excellent!