c语言唐诗300首查询 您所在的位置:网站首页 用c语言写一首诗怎么写的 c语言唐诗300首查询

c语言唐诗300首查询

2024-07-13 04:44| 来源: 网络整理| 查看: 265

/*

1、将所有的诗词都从文件中解析出来存入结构体数组poems[320] 2、调用searchPoem(),进行查询并显示查询结果 3、countPoems():利用链表对经过排序的作者指针数组进行统计并进行输出 注意:个别标题、作者字符比较多,所用空间要足够大       文件中没有第175首诗,所以其实只有319首,现已添加 */

#include #include #include  //malloc

struct Poem{     char title[256]; //第208首诗的标题很长     char author[10];     char content[512]; }; typedef struct Poem Poem;

struct AuthorInfo{     char name[10];     int poemNum;     struct AuthorInfo *next; };

typedef struct AuthorInfo AuthorInfo;

Poem poems[320]; void initPoems(); void showPoems(); void searchPoem(char *keywords,int type); void countPoems();

int main(){     initPoems();

    while(1){         printf("|--------------------------------|\n");         printf("| 1. 作者查询 | 2. 标题查询      |\n");         printf("|--------------------------------|\n");         printf("| 3. 内容查询 | 4. 统计作者信息  |\n");         printf("|--------------------------------|\n");

        printf("请输入选项: ");         int choice=0;         scanf("%d",&choice);

        switch(choice){         case 1:         case 2:         case 3:             printf("请输入查询关键字:"



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有