第14章节C语言程序的设计实例.pptVIP

  • 1
  • 0
  • 约1.84万字
  • 约 72页
  • 2017-04-01 发布于四川
  • 举报
第14章节C语言程序的设计实例

scanf(″%d″, num);  switch(num) {case 1: lookup( ); break;  case 2: insert( ); break;  case 3: delete( ); break;  case 4: modify( ); break;  case 5: display( ); break;  case 6: qiut(file); break;  default: printf(″选择错, 按任一键返回菜单!″); getch( );  } } } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. void input(file)/*读取词典*/ char file[ ];  {int i;  FILLE *fp;  char str[STRLEN1];  if((fp=fopen(file, ″r″))==NULL) {printf(″不能打开文件%s!″, file);  exit(0);  } i=0;  fscanf(fp, ″%s″, str);  while(! feof(fp)) Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. {strcpy(words[i ], str);  fscanf(fp, ″%s″, expls[i++]);  fscanf(fp, ″%s″, str);  } len=i;  fclose(fp);  } void menu( )/*菜单*/ {clrscr( );  printf(″电子词典程序\n″);  printf(″\n\n1-单词查询\n″);  printf(″2-增加词条\n″); Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. printf(″3-删除词条\n″);  printf(″4-修改词条\n″);  printf(″5-显示词条\n″);  printf(″6-退出\n\n\n″);  printf(″\n\n请选择(1~6)\n″);  } void lookup( )/*查找单词释义*/ {char word[STRLEN1];  int i;  flag=1;  while(flag) {printf(″请输入查询单词: ″);  scanf(″%s″, word);  i=search1(0, len-1, word); Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. if(i==-1) printf(″无此单词!\n″);  else printf(″%s\n″, expls[i]);  continue( );  } } void insert( )/*插入*/ {char word[STRLEN1], expl[STRLEN2];  int i, j;  flag=1;  while(flag) {printf(″请输入待插入的单词和释义: ″);  scanf(″%s%s″, word, expl); Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. i=search2(0, len, word);  if(i==-1) printf(″

文档评论(0)

1亿VIP精品文档

相关文档