/*包含多本书的图书目录*/
#include<stdio.h>
#define MAXBKS 2 //定义最多容纳的图书册数struct book // 结构体名为bool
{
char title[50];
char author[50];
float value;
};
int main()
{
struct book library[MAXBKS]; //定义结构数组
int count=0;
int index;
printf("input a title\n");
printf("press[enter]at the begin to end\n");
gets(library[count].title);
while(count<MAXBKS&&library[count].title[0]!='\0')
{
printf("input author\n");
gets(library[count].author);
printf("input value\n");

这个C语言程序展示了如何使用结构数组来管理图书信息。程序首先定义了一个包含书号、书名、作者和出版年的图书结构,接着通过用户输入创建多本书的记录。此外,还提供了一个简单的示例,演示了如何输入4名学生的3门成绩,并计算他们的总分和平均分,同样使用了结构数组来存储学生信息。
最低0.47元/天 解锁文章

4054

被折叠的 条评论
为什么被折叠?



