C语言程序设计(苏小红著)课后习题答案下载
C语言是一种计算机程序设计语言。它既有高级语言的.特点,又具有汇编语言的特点。以下是由阳光网小编整理关于C语言程序设计(苏小红著)课后习题答案下载地址,希望大家喜欢!
C语言程序设计(苏小红著)课后习题答案预览
12.1 #include<stdio.h>
typedef struct data
{
int year;
int month;
int day;
}DATA;
typedef struct work
{
char a[14];
char b[10];
char c[6];
}WORK;
typedef struct student
{
char studentName[10];
char studentSex;
DATA birthday;
WORK profession;
}STUDENT;
int main()
{
STUDENT stu={"王刚",'M',{1991,5,19},{"信息工程系","学习人员","学生"}};
printf("stu:%2s%3c%6d/%02d/%02d%4s,%4s,%4s\n",stu.studentName,stu.studentSex,stu.bi
rthday.year,stu.birthday.month,stu.birthday.day,
stu.profession.a,stu.profession.b,stu.profession.c);
return 0;
}
12.4 #include<stdio.h>
#include<string.h>
#define N 10
typedef struct people
{
char peopleName[10];
}PEOPLE;
int main()
{
int sum1=0,sum2=0,sum3=0,sum4=0;
int i;
char name[N][N];
PEOPLE stu[5]={"zhang","li","wang"};
printf("Enter their name:\n");
for(i=0;i<10;i++)
{
gets(name[i]);
if(strcmp(name[i],stu[0].peopleName)==0)
sum1++;
else if(strcmp(name[i],stu[1].peopleName)==0)
sum2++;
else if(strcmp(name[i],stu[2].peopleName)==0)
sum3++;
else
sum4++;
}
printf("stu:%4s%2d\n",stu[i].peopleName,sum[j]);
printf("stu:%4s%2d\n",stu[1].peopleName,sum2);
printf("stu:%4s%2d\n",stu[2].peopleName,sum3);
printf("%2d\n",sum4);
return 0;
}
【C语言程序设计(苏小红著)课后习题答案下载】相关文章: