c++源程序.docVIP

  • 1
  • 0
  • 约3.62千字
  • 约 4页
  • 2018-05-05 发布于河南
  • 举报
c源程序

#includeiostream #includestring.h using namespace std; void main() { char c1; void tmlr(); void tmxg(); void tmcx(); void dt(); do { coutendl; coutendl; coutendl; coutendl; cout ****************************************\n; cout ****************************************\n; cout ** 1.题目录入 **\n; cout ** 2.题目修改 **\n; cout ** 3.题目查询 **\n; cout ** 4.答题 **\n; cout ** 5.退出 **\n; cout ****************************************\n; cout ****************************************\n; cout 请输入选项(1~5):; cinc1; if(c1==1) tmlr(); else if(c1==2)tmxg(); else if(c1==3)tmcx(); else if(c1==4)dt(); else if(c1==5) { exit(0); } }while(1); } void tmlr() { FILE *fp; char lx[4],tm[200],da[100],c; fp=fopen(test.txt,a+); do { cout请输入题目类型:; cinlx; cout请输入题目题干:; cintm; cout请输入题目答案:; cinda; fputs(类型:,fp); fputs(lx,fp); fputs(\n,fp); fputs(题目:,fp); fputs(tm,fp); fputs(\n,fp); fputs(答案:,fp); fputs(da,fp); fputs(\n,fp); system(pause); cout是否继续输入题目(Y/N):; cinc; } while(c==y || c==Y); fclose(fp); } void tmcx() { FILE *fp; int i=0; char lx[4],tm[200],da[100],c,tm1[200],tm2[200]; fp=fopen(test.txt,r); do { cout请输入查找题目:endl;; cintm1; cintm2题目:; strcat(tm2,tm1); do { fgets(lx,200,fp); fgets(tm,200,fp); fgets(da,200,fp); } while(strcmp(tm,tm2)!=0 strcmp(tm,)!=0); if(strcmp(tm,)==0) cout该题目没检索到; else { cout类型:lxendl; cout题目:tmendl; cout答案:daendl; } system(pause);

文档评论(0)

1亿VIP精品文档

相关文档