試卷管理系統(tǒng)_第1頁
試卷管理系統(tǒng)_第2頁
試卷管理系統(tǒng)_第3頁
試卷管理系統(tǒng)_第4頁
試卷管理系統(tǒng)_第5頁
已閱讀5頁,還剩15頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

課程實(shí)驗(yàn)設(shè)計(jì)課程名稱程序設(shè)計(jì)基礎(chǔ)(C)班級計(jì)算實(shí)驗(yàn)日期姓名學(xué)號實(shí)驗(yàn)成績實(shí)驗(yàn)名稱試卷管理系統(tǒng)實(shí)驗(yàn)?zāi)康募耙髮?shí)驗(yàn)環(huán)境CodeBlocks實(shí)驗(yàn)內(nèi)容老師在教學(xué)過程中,會(huì)經(jīng)常以試卷的形式來檢查學(xué)生的學(xué)習(xí)狀況。先由你來協(xié)助老師設(shè)計(jì)一種系統(tǒng)。該系統(tǒng)中只有2種題型:單選題、填空題。其中單選題:題目編號、題目、選項(xiàng)A、選項(xiàng)B、選項(xiàng)C、選項(xiàng)D、答案填空題:題目編號、題目、答案功效:功效:試題添加、刪除、修改、查詢功效(1)試題添加:向試題庫追加寫入一道新的題目,規(guī)定題目編號與已存題目的編號不重復(fù);全部內(nèi)容不能為空;(2)試題刪除:通過題目編號進(jìn)行題目的刪除;(3)刪除全部題目;(4)試題修改:通過題目編號修改指定的題目的內(nèi)容;(5)試題查詢:通過題目編號查詢指定的題目的全部內(nèi)容;(6)統(tǒng)計(jì)共有多少道題目;(7)查詢題目中含有某個(gè)特定內(nèi)容(顧客輸入)的全部題目內(nèi)容;(8)自動(dòng)隨機(jī)生成由單選題、填空題合在一起的試卷及答案2個(gè)文獻(xiàn),各題型的題目數(shù)由顧客輸入;(9)以上功效規(guī)定通過菜單的方式進(jìn)行操作;規(guī)定對對應(yīng)內(nèi)容進(jìn)行必要的正當(dāng)性檢查算法描述及實(shí)驗(yàn)步驟(用適宜的形式體現(xiàn)算法設(shè)計(jì)思想與算法實(shí)現(xiàn)環(huán)節(jié))調(diào)試過程及實(shí)驗(yàn)結(jié)果總有一種錯(cuò)誤是說那個(gè)函數(shù)初始化的問題,最后通過問同窗解決了。總結(jié)附錄#include<stdio.h>#include<stdlib.h>#include<time.h>//voidxiugai();//voidtj();//voidsc();//voidsc2();//voidcx();//voidcx2();FILE*fp1;FILE*fp2;FILE*fp3;FILE*fp4;voidxiugai(){charg;printf("與否修改題目?是y,否n\n");scanf("%c",&g);if(g=='y'){inth;printf("請輸入修改的范疇:選擇請輸1;填空請輸2\n");scanf("%d",&h);intj;printf("請輸入要修改的題號\n");scanf("%d",&j);charxiugai[200];printf("請輸入修改的內(nèi)容\n");scanf("%s",xiugai);if(h==1){charb2;printf("請輸入答案\n");scanf("%c",&b2);//b2是修改的答案;fp1=fopen("D://xuanze.txt","r");fp2=fopen("D://xuanze2.txt","w");fp3=fopen("D://answer1.txt","r");fp4=fopen("D://answer3.txt","w");intnumber1,number2;chartimu[200];chara2;//a2是選項(xiàng),即選擇的答案;while(!feof(fp1)){fscanf(fp1,"%d%s\n",&number1,timu);fprintf(fp2,"%d%s\n",number1,timu);//不修改的內(nèi)容;fscanf(fp3,"%d%c\n",&number2,&a2);fprintf(fp4,"%d%c\n",number2,a2);if(number1==j){fprintf(fp2,"%d%s\n",number1,xiugai);fprintf(fp4,"%d%c\n",number1,b2);}}}if(h==2){charb2[20];printf("請輸入答案\n");scanf("%s",b2);//b2是修改的答案;fp1=fopen("D://tiankong.txt","r");fp2=fopen("D://tiankong2.txt","w");fp3=fopen("D://answer2.txt","r");fp4=fopen("D://answer4.txt","w");//2是填空的答案;4是修改之后的答案intnumber1,number2;chartimu[200];chara2[20];//a2是選項(xiàng),即tiankong的答案;while(!feof(fp1)){fscanf(fp1,"%d%s\n",&number1,timu);fprintf(fp2,"%d%s\n",number1,timu);//不修改的題目內(nèi)容;fscanf(fp3,"%d%s\n",&number2,a2);fprintf(fp4,"%d%s\n",number2,a2);//不修改的答案內(nèi)容;if(number1==j){fprintf(fp2,"%d%s\n",number1,xiugai);fprintf(fp4,"%d%s\n",number1,b2);//修改的題目和答案}}}fclose(fp1);fclose(fp2);fclose(fp3);fclose(fp4);}}voidtj(){chara;printf("與否進(jìn)行試題添加?是y,否n\n");scanf("%c",&a);if(a=='y'){printf("對選擇添加請輸1;對填空添加請輸2\n");intb;scanf("%d",&b);if(b==1){fp1=fopen("D://xuanze.txt","a");intnumber,i;chartimu[200];while(!feof(fp1)){scanf("%d%s",&number,timu);i++;}chartianjia[200];printf("請輸入要添加的題目\n");scanf("%s",tianjia);fprintf(fp1,"%d%s\n",i,tianjia);chardaan[30];printf("請輸入所添加題目的答案\n");fprintf(fp1,"%s\n",daan);}if(b==2){fp1=fopen("D://tiankong.txt","a");intnumber,i;chartimu[200];while(!feof(fp1)){scanf("%d%s",&number,timu);i++;}chartianjia[200];printf("請輸入要添加的題目\n");scanf("%s",tianjia);fprintf(fp1,"%d%s\n",i,tianjia);chardaan[100];printf("請輸入所添加題目的答案\n");fprintf(fp1,"%s\n",daan);}fclose(fp1);}}voidsc(){charc;printf("與否進(jìn)行試題刪除?是y,否n\n");scanf("%c",&c);if(c=='y'){intd;printf("刪除選擇請輸1;刪除填空請輸2\n");scanf("%d",&d);if(d==1){fp1=fopen("D://xuanze.txt","r");fp2=fopen("D://xuanze2.txt","w");inte;printf("請輸入要?jiǎng)h除的題目的題號\n");scanf("%d",&e);intnumber;chartimu[200];while(!feof(fp1)){fscanf(fp1,"%d%s\n",&number,timu);fprintf(fp2,"%d%s\n",number,timu);if(number==e){break;}fscanf(fp1,"%d%s\n",&number,timu);fprintf(fp2,"%d%s\n",number-1,timu);}}if(d==2){fp1=fopen("D://tiankong,txt","r");fp2=fopen("D://tiankong2.txt","w");inte;printf("請輸入要?jiǎng)h除的題目的題號\n");scanf("%d",&e);intnumber;chartimu[200];while(!feof(fp1)){fscanf(fp1,"%d%s\n",&number,timu);fprintf(fp2,"%d%s\n",number,timu);if(number==e){break;}fscanf(fp1,"%d%s\n",&number,timu);fprintf(fp2,"%d%s\n",number-1,timu);}}fclose(fp1);fclose(fp2);}}voidsc2(){charf;printf("與否刪除全部題目?是y;否n\n");scanf("%c",&f);if(f=='y'){fp1=fopen("D://tiankong,txt","w");fp2=fopen("D://xuanze.txt","w");fclose(fp1);fclose(fp2);}}voidcx(){chark;printf("與否查詢(輸入題號查詢題目的全部)是y,否n\n");scanf("%c",&k);if(k=='y'){intm;printf("請輸入查詢的范疇選擇輸入1;填空輸入2\n");scanf("%d",&m);fp1=fopen("D://xuanze.txt","r");fp2=fopen("D://tiankong.txt","r");fp3=fopen("D://answer.txt","r");fp4=fopen("D://answer.txt","r");if(m==1){inttihao2;printf("請輸入題號\n");scanf("%d",&tihao2);intnumber;chartimu[200];chardaan;while(!feof(fp1)){fscanf(fp1,"%d%s\n",&number,timu);fscanf(fp3,"%d%c\n",&number,&daan);if(number==tihao2){printf("%d%s%c\n",number,timu,daan);}}}if(m==2){inttihao2;printf("請輸入題號\n");scanf("%d",&tihao2);intnumber;chartimu[200];chardaan[100];while(!feof(fp1)){fscanf(fp1,"%d%s\n",&number,timu);fscanf(fp3,"%d%s\n",&number,daan);if(number==tihao2){printf("%d%s%s\n",number,timu,daan);}}}fclose(fp1);fclose(fp2);fclose(fp3);fclose(fp4);}}voidcx2()//特定查詢{inti=0,j=0;fp1=fopen("D://xuanze.txt","r");fp2=fopen("D://tiankong.txt","r");intnumber;chartimu[200];while(!feof(fp1)){fscanf(fp1,"%d%s\n",&number,timu);i++;}while(!feof(fp2)){fscanf(fp2,"%d%s\n",&number,timu);j++;}printf("一共有%d道題\n",i+j);fclose(fp1);fclose(fp2);printf("與否進(jìn)行特定查詢是y否n\n");charx;scanf("%c",&x);if(x=='y'){fp1=fopen("D://xuanze.txt","r");fp2=fopen("D://tiankong.txt","r");chara[10],b[100];inti,m,j;printf("請輸入你要查詢的特定內(nèi)容\n");scanf("%c",&a[10]);fp1=fopen("D://xuanzhe.txt","r");fp2=fopen("D://tiankong.txt","r");for(i=0;i<100;i++){fscanf(fp1,"%d%c",&m,&b[100]);for(i=0;i<100;i++){for(j=0;j<100;j++){if(b[i]==a[j]){printf("%d%c\n",m,b[100]);}}}}fclose(fp1);fclose(fp2);}}intmain(){//tj();//xiugai();//sc();//sc2();//cx();//cx2();fp1=fopen("D://xuanze.txt","r");fp2=fopen("D://tiankong.txt","r");//fp1改成fp2了fp3=fopen("D://shijuan.txt","w");intxz;printf("請輸入選擇題的數(shù)量\n");scanf("%d",&xz);inttk;inti;printf("請輸入填空題的數(shù)量\n");scanf("%d",&tk);printf("11111\n");fprintf(fp3,"選擇\n");intnumber;chartimu[200];charxuanxiang[200];//新增,選項(xiàng)那一行數(shù)據(jù)inti1;srand((unsigned)time(NULL));for(i=0;i<xz;i++){//inti1;//srand((unsigned)time

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論