编写程序,用以建立某车间的职工档案信息,每个职工档案信息包括:姓名、邮编、电话及家庭住址。
【正确答案】:员工结构体中包括四个字符数组成员,并在主程序中定义结构体的数组保存多个员工信息。 main() { struct employee { char name[20]; unsigned long zlpcode; unsigned long phone; char addr[30]; } struct employee workshop[50]; int i; for(i=0;i<50;i++) { prinff("the%2d th employee:\n",i+1); prinff("Name:"); gets(workshop[i].name); prinff("Zipcode:"); scanf("%Un,&workshop[i].zipcode); prinff("phone number:"); scanf("%Un,&workshop[i].phone); prinff("Address:"); gets(workshop[i].addr); } }