C語言上機題庫和答案_第1頁
C語言上機題庫和答案_第2頁
C語言上機題庫和答案_第3頁
C語言上機題庫和答案_第4頁
免費預覽已結束,剩余77頁可下載查看

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

0已知在文件IN.DAT中存有若干個(個數(shù)〈200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CalValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求出這些數(shù)中的各位數(shù)字之和是奇數(shù)的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz,最后調用函數(shù)WriteDatO把所求的結果輸出到文件0UT1.DAT中。注意:部分源程序存放在PR0G1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>ttinclude<conio.h>#defineMAXNUM200intxx[MAXNUM];inttotNum=0:/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/*平均值*/intReadDat(void);voidWriteDat(void);voidCalValue(void)(inti,n;longent=0;for(i=0;i<MAXNUM;i++){if(xx[i]>0){/?是正整數(shù)?/totNum++;/?計數(shù)?//?求各位之和?/n=xx[i]/1000+(xx[i]%1000)/100+(xx[i]%100)/10+xx[i]%10;if(n&l){/?是奇數(shù)?/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/?計算累加和?/totPjz=(double)ent/totCnt;/?計算平均值?/voidmain()inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDatO){printf("數(shù)據(jù)文件IN.DAT不能打開!'007'n");return;}CalValue();printf("文件IN.DAT中共有正整數(shù)=%d個、n”,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個い",totCnt)printf("平均值=%.21f\n",totPjz);WriteDat();intReadDat(void){FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);}fclose(fp);return0;)voidWriteDat(void)(FILE*fp;fp=fopen("OUT1.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);)!已知在文件IN.DAT中存有若干個(個數(shù)く200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CalValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求出這些數(shù)中的各位數(shù)字之和是偶數(shù)的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz,最后調用函數(shù)WriteDat()把所求的結果輸出到文件0UT2.DAT中。注意:部分源程序存放在PR0G1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat。和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#includeくconio.h>#defineMAXNUM200intxx[MAXNUM];inttotNumニ〇;/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/?平均值?/intReadDat(void);voidWriteDat(void);voidCalValue(void)(inti,n;longent=0;for(i=0;iくMAXNUM;i++){if(xx[i]>0){/?是正整數(shù)?/

totNum++;/?計數(shù)?//?求各位之和?/n=xx[i]/1000+(xx[i]%1000)/100+(xx[i]%100)/10+xx[i]%10;if((n&l)==0){/*是偶數(shù)?/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/})}totPjz=(double)ent/totCnt;/?計算平均值?/}voidmain(){inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件IN.DAT不能打開!、007\n〃);return;)CalValue();printf("文件1N.DAT中共有正整數(shù)ニ%d個ゝn”,totNum);printf("符合條件的正整數(shù)的個數(shù)二%d個、n”,totCnt);printf("平均值=%.21f\n”,totPjz);WriteDatO;intReadDat(void)(FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);)fclose(fp);return0;}voidWriteDat(void)(FILE*fp;fp=fopen("0UT2.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);)2已知在文件IN.DAT中存有若干個(個數(shù)〈200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CalValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)右移1位后,產(chǎn)生的新數(shù)是奇數(shù)的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)(右移前的值)的算術平均值totPjz,最后調用函數(shù)WriteDatO把所求的結果輸出到文件0UT3.DAT中。注意:部分源程序存放在PR0G1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。ftinclude<stdio.h>ftinclude<conio.h>ftdefineMAXNUM200intxx[MAXNUM];inttotNum=0;/*文件IN.DAT中共有多少個正整數(shù)*/inttotCnt=0:/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/*平均值*/intReadDat(void);voidWriteDat(void);voidCalValue(void)(inti;longent=0;for(i=0;i<MAXNUM;i++){if(xx[i]>0){/?是正整數(shù)*/totNum++;/?計數(shù)?/if((xx[i]?l)&1){/?右移1位后是奇數(shù)?/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/}totPjz=(double)ent/totCnt;/?計算平均值?/voidmain()(inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件IN.DAT不能打開!'007'n");return;}CalValue();printf("文件IN.DAT中共有正整數(shù)成d個、n”,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個、n",totCnt)printf("平均值=%.21f、n",totPjz);WriteDat();intReadDat(void)(FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,”,&xx[i++]);)fclose(fp);return0;}voidWriteDat(void){FILE*fp;fp=fopen("0UT3.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);)3已知在文件IN.DAT中存有若干個(個數(shù)く200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CalValue(),其功能要求:L求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)右移1位后,產(chǎn)生的新數(shù)是偶數(shù)的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)(右移前的值)的算術平均值totPjz,最后調用函數(shù)WriteDat()把所求的結果輸出到文件0UT4.DAT中。注意:部分源程序存放在PR0G1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。^include<stdio.h>#include<conio.h>#defineMAXNUM200intxx[MAXNUM];inttotNum=0;/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/?平均值?/intReadDat(void);voidWriteDat(void);voidCalValue(void)(inti;longent=0;for(i=0;i<MAXNUM;i++){if(xx[i]>〇){/?是正整數(shù)?/totNum++;/?計數(shù)?/if(((xx[i]>>1)&1)==0){/?右移1位后是偶數(shù)?/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/totPjz=(double)ent/totCnt;/?計算平均值?/voidmain(){inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件IN.DAT不能打開!、007\n");return;)CalValue();printf("文件IN.DAT中共有正整數(shù)成d個、n〃,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個、n”,totCnt)printf("平均值二%.21f'n",totPjz);WriteDatO;intReadDat(void){FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);)fclose(fp);return0;)voidWriteDat(void)(FILE*fp;fp=fopen("0UT4.DAT","w")fprintf(fp,w%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);)已知在文件IN.DAT中存有若干個(個數(shù)〈200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CalValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)中的個位數(shù)位置上的數(shù)字是3、6和9的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz,最后調用函數(shù)WriteDat()把所求的結果輸出到文件0UT5.DAT中。注意:部分源程序存放在PR0G1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<conio.h>#defineMAXNUM200intxx[MAXNUM];inttotNum=0;/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/?平均值?/intReadDat(void);voidWriteDat(void);voidCalValue(void){inti,n;longent=0;ford=0;i<MAXNUM;i++){if(xx[i]>0){/?是正整數(shù)?/totNum++;/?計數(shù)?/n=xx[i]%10;/?求個位?/if(n&&(n%3)==〇){/?個位是3的倍數(shù)且不為〇,亦即3、6、9*/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/})totPjz=(double)ent/totCnt;/?計算平均值?/voidmain()inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDatO){printf("數(shù)據(jù)文件IN.DAT不能打開!'007\n〃);return;)CalValue();printf(〃文件IN.DAT中共有正整數(shù)二%d個、n”,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個"",totCnt)printf(“平均值二%.21f'n",totPjz);WriteDat();intReadDat(void){FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);}fclose(fp);return0;}voidWriteDat(void)(FILE*fp;fp二fopen("0UT5.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);)已知在文件IN.DAT中存有若干個(個數(shù)く200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CaIValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)中的十位數(shù)位置上的數(shù)字是2、4和8的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz,最后調用函數(shù)WriteDat()把所求的結果輸出到文件0UT6.DAT中。注意:部分源程序存放在PROGLC中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDatO和輸出數(shù)據(jù)函數(shù)WriteDat0的內容。#include<stdio.h>ttinclude<conio.h>#defineMAXNUM200intxx[MAXNUM];inttotNum=0;/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt二〇;/?符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/?平均值?/intReadDat(void);voidWriteDat(void);voidCalValue(void)(inti,n;longent=0;for(i=0;i<MAXNUM;i++){if(xx[i]>〇){/?是正整數(shù)?/totNum++;/?計數(shù)?/n=(xx[i]%100)/10;/?求十位數(shù)?/if(n==2IIn-4||n=8){/?十位數(shù)是2、4、8*/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/)}}totPjz=(double)ent/totCnt;/?計算平均值?/voidmain。(inti;clrscr();for(i=0;i<MAXNLTM;i++)xx[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件IN.DAT不能打開!\007\n");return;)CalValue();printf("文件IN.DAT中共有正整數(shù)二%d個、n”,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個、n",totCnt)printf("平均值=%.21f\n",totPjz);WriteDatO;intReadDat(void){FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);)fclose(fp);return0;}voidWriteDat(void)(FILE*fp;fp=fopen("0UT6.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);}已知在文件IN.DAT中存有若干個(個數(shù)く200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CaIValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)中的百位數(shù)位置上的數(shù)字是1、5和?的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz,最后調用函數(shù)WriteDat()把所求的結果輸出到文件0UT7.DAT中。注意:部分源程序存放在PROG1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat。和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<conio.h>^defineMAXNUM200intxx[MAXNUM];inttotNum=0;/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/?平均值?/intReadDat(void);voidWriteDat(void);voidCalValue(void){inti,n;longent=0;for(i=0;i<MAXNUM;i++){if(xx[i]>0){/?是正整數(shù)?/totNum++;/?計數(shù)?/n=(xx[i]%l000)/100;/?求百位數(shù)?/if(n==l||n==5IIn==7){/?百位數(shù)是1、5、7*/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/))}totPjz=(double)ent/totCnt;/?計算平均值?/voidmain()(inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件IN.DAT不能打開!'007\n");return;}CalValue();printf(〃文件IN.DAT中共有正整數(shù)成d個、n”,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個い",totCnt)printf("平均值二%.21f'n",totPjz);WriteDat();intReadDat(void){FILE*fp;inti=0;if((fp=fopen("in?dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,〃,&xx[i++]);)fclose(fp);return0;)voidWriteDat(void)(FILE*fp;fp=fopen("〇UT7.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);)已知在文件IN.DAT中存有若干個(個數(shù)く200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CalValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)中的千位數(shù)位置上的數(shù)字大于個位數(shù)位置上的數(shù)字的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz?最后調用函數(shù)WriteDat()把所求的結果輸出到文件0UT8.DAT中。注意:部分源程序存放在PR0GLC中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<conio.h>#defineMAXNUM200intxx[MAXNUM];inttotNum=0;/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/?平均值?/intReadDat(void);voidWriteDat(void);voidCalValue(void)inti;longent=0for(i=0;i<MAXNUM;i++){if(xx[i]>0){/?是正整數(shù)*/totNum++ノ?計數(shù)?/if(xx[i]/1000>xx[i]%10){/*千位數(shù)大于個位數(shù)?/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/})}totPjz=(double)ent/totCnt;/?計算平均值?/voidmain(){inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件IN.DAT不能打開!'007'n");return;)CalValueO;printf("文件IN.DAT中共有正整數(shù)=%d個、n”,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個'n",totCnt)printf("平均值二%.21f'n",totPjz);WriteDat();intReadDat(void)(FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);}fclose(fp);return0;FILE*fp;fp=fopen("0UT8.DAT","w");fprintf(fp,”猊、n%d\n%.21f\n”,totNum,totCnt,totPjz);fclose(fp);)已知在文件IN.DAT中存有若干個(個數(shù)〈200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CalValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)中的百位數(shù)位置上的數(shù)字小于十位數(shù)位置上的數(shù)字的數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz,最后調用函數(shù)WriteDatO把所求的結果輸出到文件0UT9.DAT中。注意:部分源程序存放在PR0G1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。^include<stdio.h>ftinclude<conio.h>^defineMAXNl'M200intxx[MAXNUM];inttotNum=0;/*文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/*平均值*/intReadDat(void);voidWriteDat(void);voidCalValue(void)(inti;longent=0;for(i=0;i<MAXNUM;i++){if(xx[i]>0){/?是正整數(shù)?/totNum++;/?計數(shù)?/if((xx[i]%1000)/100<(xx[i]%100)/10){/?百位數(shù)小于十位數(shù)*/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/})totPjz=(double)ent/totCnt;/?計算平均值?/voidmain()inti;cirscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDat()){printf(〃數(shù)據(jù)文件IN.DAT不能打開!'007\n");return;)CalValue();printf("文件IN.DAT中共有正整數(shù)=%d個、n”,totNum);printf("符合條件的正整數(shù)的個數(shù)二%d個、n”,totCnt);printf("平均值=%.21f\n",totPjz);WriteDat();)intReadDat(void){FILE*fp;inti=0;if((fp=fopen(*in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);}fclose(fp);return0;}voidWriteDat(void)(FILE*fp;fp二fopen("0UT9.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n”,totNum,totCnt,totPjz);fclose(fp);}已知在文件IN.DAT中存有若干個(個數(shù)く200)四位數(shù)字的正整數(shù),函數(shù)ReadDat()是讀取這若干個正整數(shù)并存入數(shù)組xx中。請編制函數(shù)CaIValue(),其功能要求:1.求出這文件中共有多少個正整數(shù)totNum;2.求這些數(shù)中的千位數(shù)位置上的數(shù)字與十位數(shù)位置上的數(shù)字均為的奇數(shù)的個數(shù)totCnt,以及滿足此條件的這些數(shù)的算術平均值totPjz,最后調用函數(shù)WriteDatO把所求的結果輸出到文件OUT10.DAT中。注意:部分源程序存放在PR0G1.C中。請勿改動主函數(shù)main()、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat0的內容。#include<stdio.h>#include<conio.h>^defineMAXNUM200intxx[MAXNUM];inttotNum=0;/?文件IN.DAT中共有多少個正整數(shù)?/inttotCnt=0;/*符合條件的正整數(shù)的個數(shù)?/doubletotPjz=0.0;/?平均值?/intReadDat(void);voidWriteDat(void);voidCalValue(void){inti;longent=0;for(i=0;i<MAXNUM;i++){if(xx[i]>0){/?是正整數(shù)?/totNum++;/?計數(shù)?/if((xx[i]/1000)&l&&((xx[i]%100)/10)&l){/?千位數(shù)和十位數(shù)均為奇數(shù)?/totCnt++;/?統(tǒng)計個數(shù)?/ent+=xx[i];/*計算累加和?/totPjz=(double)ent/totCnt;/?計算平均值?/voidmain(){inti;clrscr();for(i=0;i<MAXNUM;i++)xx[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件IN.DAT不能打開!'007\n〃);return;CalValueO;printf("文件IN.DAT中共有正整數(shù)球d個、n”,totNum)printf("符合條件的正整數(shù)的個數(shù)二%d個、n",totCnt)printf("平均值二%.21f'n",totPjz);WriteDat();intReadDat(void){FILE*fp;inti=0;if((fp=fopen("in.dat","r"))==NULL)return1;while(!feof(fp)){fscanf(fp,"%d,",&xx[i++]);)fclose(fp);return0;)voidWriteDat(void)(FILE*fp;fp=fopen("0UT10.DAT","w");fprintf(fp,"%d\n%d\n%.21f\n",totNum,totCnt,totPjz);fclose(fp);}10函數(shù)ReadDat()實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)ComWordO分別計算出10個不區(qū)分大小寫的英文單詞(you,for,your,on,no,if,the,in,to,all)的頻數(shù)并依次存入整型數(shù)組yy[0]至yy[9]中,最后調用函數(shù)WriteDat()把結果yy輸出到文件PSI.OUT中。原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PROG1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)mainO>讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<string.h>#include<conio.h>#include<ctype.h>charWORD[10][10]二{"you","fof","your","on","no","if","the","in","to","all"};charxx[50][80];/*xx存放上是一篇50行80列的文章?/intyy[10];/?各元素對應10個單詞的頻度?/intmaxiine=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidComWord(void){inti,j;charstr[80];/*存放從xx中臨時取出的ー個單詞?/char*pch;for(i=0;i<10;i++)yy[i]=0;/?計數(shù)數(shù)組全部清〇?/for(i二〇;i<50;i++){pch=xx[i];/?指針pch指向這一行的行首?/while(*pch){/*循環(huán)直到行結束?/j=0;while(isalpha(*pch))/?這個循環(huán)用于從當前行取出ー個單詞,并存放于str中?/str[j++]=*pch++;str[j]=0;/?給字符串補上〇?/if(str[0]){/?不空?//?循環(huán)和WORD中的單詞一ー比較?/for(j=0;j<10;j++){if(stricmp(str,WORD[j])==0){/*找到?/yy[j]++;/?計數(shù)?/break;pch++;})}voidmain()clrscr();for(i=0;i<10;i++)yy[i]=0;if(ReadDat()){printf("數(shù)據(jù)文件ENG.IN不能打開!'n\007〃);return;)ComWord();WriteDat();)intReadDat(void){FILE*fp;inti=0;char*p;if((fp=fopen("eng?in","r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;)maxline=i;fclose(fp);return0;)voidWriteDat(void)(FILE*fp;inti;fp=fopen("psi.out","w");for(i=0;i<10;i++){printf("%s=%d\n",strupr(W0RD[i]),yy[i]);fprintf(fp,"%d\n",yy[i]);}fclose(fp);}11函數(shù)ReadDat()實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)ComWord()分別計算出單詞長度3,5,7,9的單詞數(shù)以及單詞總數(shù)并依次存入整型數(shù)組yy[0]至yy[4I中,最后調用函數(shù)WriteDat()把結果yy輸出到文件PS2.OUT中。原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PR0G1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDatO的內容。#include<stdio.h>#include<string.h>#include<conio.h>#include<ctype.h>charxx[50][80];intyy[5];intmaxline=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidComWord(void){inti,n;char*pch;for(i=0;i<5;i++)yy[i]=0;/?數(shù)組yy全部清〇?/for(i=0;i<50;i++){pch=xx[i];/?指針pch指向這一行的行首?/while(*pch){/?循環(huán)直到行結束?/if(isalpha(*pch))yy[4]++;/?單詞計數(shù)?/for(n二〇;isalpha(*pch);pch++)n++;/?這個循環(huán)用于計算單詞的長度?/if(n==3IIn==5||n==7||n==9)/?符合條件?/yy[(n-3)/2]++;/?表達式(n-3)/2可以巧妙地求出下標值?/pch++;/?跳過空格?/)inti;clrscr();for(i=0;i<5;i++)yy[i]=0;if(ReadDatO){printf("數(shù)據(jù)文件ENG.IN不能打開!'n\007");return;}ComWord();WriteDat();)intReadDat(void)|FILE*fp;inti=0;char*p;if((fp=fopen("eng.in",r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;)maxiine=i;fclose(fp);return0;}voidWriteDat(void){FILE*fp;inti;fp=fopen("ps2.out","w");for(i=0;i<5;i++)fprintf(fp,"%d\n",yy[i]);printf("單詞長度為3的單詞數(shù)=%d\n",yy[0]);printf("單詞長度為5的單詞數(shù)二%d\n",yy[l]);printf("單詞長度為7的單詞數(shù)=%d\n",yy[2]);printf("單詞長度為9的單詞數(shù)二%d\n",yy[3]);printf("單詞的總數(shù)=%d\n",yy[4]);fclose(fp);)12函數(shù)ReadDat()實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組XX中;請編制函數(shù)ComWordO分別計算出單詞長度2,4,6,8的單詞數(shù)以及單詞總數(shù)并依次存入整型數(shù)組yy[0]至yy[4]中,最后調用函數(shù)WriteDat()把結果yy輸出到文件PS3.OUT中。原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PR0G1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每単詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>^include<string.h>#include<conio.h>#include<ctype.h>charxx[50][80];intyy[5];intmaxline=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidComWord(void)(inti,n;char*pch;for(i二〇;iく5;i++)yy[i]二〇;/?數(shù)組yy全部清。*/for(i=0;i<50;i++){pch=xx[i];/*指針pch指向這一行的行首?/while(*pch){/?循環(huán)直到行結束?/if(isalpha(*pch))yy[4]++;/?單詞計數(shù)?/for(n=0;isalpha(*pch);pch++)n++;/?這個循環(huán)用于計算單詞的長度?/if(n==2IIn==4||n==6||n=8)/?符合條件?/yy[n/2-l]++;/?表達式n/2T可以巧妙地求出下標值?/pch++;/?跳過空格?/voidmain()(inti;cirscr();for(i=0;i<5;i++)yy[i]=0;if(ReadDat()){printf(〃數(shù)據(jù)文件ENG.IN不能打開!'n\007”);return;)ComWord();WriteDat();intReadDat(void)(FILE*fp;inti=0;char*p;if((fp=fopen("eng?in","r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;}maxline=i;fclose(fp);return0;}voidWriteDat(void){FILE*fp;inti;fp=fopen("ps3.out","w");for(i=0;i<5;i++)fprintf(fp,"%d\n",yy[i]);printf("單詞長度為2的單詞數(shù)=%d\n",yy[0]);printf("單詞長度為4的單詞數(shù)二%d\n",yy[l]);printf("單詞長度為6的單詞數(shù)二%d\n",yy[2]);printf("單詞長度為8的單詞數(shù)二%d\n",yy[3]);printf("單詞的總數(shù)=%d\n",yy[4]);fclose(fp);13函數(shù)ReadDatO實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)ComWordO分別計算出10個不區(qū)分大小寫的英文單詞的首字母(b,c,f,s,n,r,u,e,o,p)的頻數(shù)并依次存入整型數(shù)組yy[0]至yy[9]中,最后調用函數(shù)WriteDat()把結果yy輸出到文件PS4.OUT中。原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PR0G1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDatO的內容。#include<stdio.h>#include<string.h>^include<conio.h>#include<ctype.h>charWORD[11]={"bcfsnrueop"};charxx[50][80];intyy[10];intmaxline=0; /?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidComWord(void)(int i,j;char c;char*pch;for(i=0;i<10;i++)yy[i]=0;/?數(shù)組yy全部清〇?/for(i=0;i<50;i++){pch=xx[i];/?指針pch指向這一行的行首?/while(*pch){/?循環(huán)直到行結束?/if(isalpha(*pch)){c=*pch&Oxdf;/?單詞的首字母,"&Oxdf”可以轉換成大寫?/for(j=0;jく10;j++){if(c=(WORD[j]&Oxdf)){yy[j++]++;break;while(isalpha(*pch))pch++;/*這個循環(huán)用于將pch推進到下ー單詞?/pch++;/?跳過空格?/)voidmain()(inti;clrscr();for(i=0;i<10;i++)yy[i]=0;if(ReadDatO){printf("數(shù)據(jù)文件ENG.IN不能打開!、n\007");return;)ComWord();WriteDat();intReadDat(void)(FILE*fp;inti=0;char*p;if((fp=fopen("eng?in","r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;)maxline=i;fclose(fp);return0;voidWriteDat(void)FILE*fp;inti;fp=fopen("ps4,out”,w");for(i=0;i<10;i++){printf("%c=%d\n",W0RD[i],yy[i]);fprintf(fp,"%d\n",yy[i]);)fclose(fp);)14函數(shù)ReadDat()實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)ComWordO分別計算出10個不區(qū)分大小寫的英文單詞的尾字母(k,y,f,s,n,r,u,e,o,p)的頻數(shù)并依次存入整型數(shù)組yy[0]至yy[9]中,最后調用函數(shù)WriteDat()把結果yy輸出到文件PS5.OUT中。原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PROGLC中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<string.h>#include<conio.h>#include<ctype.h>charWORD[11]={"kyfsnrueop"};charxx[50][80];intyy[10];intmaxline=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidComWord(void){int i,j;char c;char*pch;for(i=0;i<10;i++)yy[i]=0;/?數(shù)組yy全部清。*/for(i=0;i<50;i++){pch=xx[i];/*指針pch指向這一行的行首?/while(*pch){/?循環(huán)直到行結束?/while(*pch&&!isalpha(*pch))pch++;/?去掉前面的空格?/while(*pch&&isalpha(*pch))pch++;/*這個循環(huán)用于將pch推進到單詞的末尾?/c=*(pch-l)&Oxdf;/*pch-1指向末尾的字符,"&Oxdf”可以轉換成大寫*/for(j=0;j<10;j++){if(c==(WORD[j]&Oxdf)){yy□++]++;break;voidmain()(,inti;clrscr();for(i=0;i<10;i++)yy[i]=0;if(ReadDatO){printf("數(shù)據(jù)文件ENG.IN不能打開!、n\007〃);return;}ComWord();WriteDat();}intReadDat(void){FILE*fp;inti=0;char*p;if((fp=fopen〈eng.in","r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;)maxline=ifclose(fp);return0;voidWriteDat(void){FILE*fp;inti;fp=fopen("ps5?out","w");for(i=0;i<10;i++){printf("%c=%d\n",W0RD[i],yy[i]);fprintf(fp,"%d\n",yy[i]);)fclose(fp);}15函數(shù)ReadDat()實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)DelWordO分別按行刪除空格、標點符號以及!0個不區(qū)分大小寫的英文單詞(you,for,your,on,no,if,the,in,to,all),余下的單詞按順序重新存入數(shù)組xx中,最后調用函數(shù)WriteDat()把結果xx輸出到文件PS6.OUT中。例如:原文:Youareastudent.結果:areastudent原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PROG1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>^include<string.h>#include<conio.h>#include<ctype.h>charW0RD[10][10]={"you","for","your","on","no","if*,"the","in","to","all");charxx[50][80];intmaxline=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidDelWord(void)int i,j;char line[80];char str[80];/*存放從xx中臨時取出的ー個單詞?/char* pch;for(i=0;i<50;i++){pch=xx[i];/*指針pch指向這一行的行首?/line[〇]=0;while(*pch){/?循環(huán)直到行結束?/j=0;while(isalpha(*pch))/*這個循環(huán)用于從當前行取出ー個單詞,并存放于str中?/str[j++]=*pch-H-;str[j]=0;/*給字符串補上0?/if(str[〇]){/?不空?//?循環(huán)和WORD中的單詞 比較?/for(j=0;j<10;j++){if(stricmp(str,WORD[j])==〇)/?找到?/break;}if(j>=10)/?沒找到?/strcat(line,str);}pch++;)strcpy(xx[i],line);)voidmain(){clrscr();if(ReadDat()){printf("數(shù)據(jù)文件ENG.IN不能打開!、n\007");return;)DelWordO;WriteDat();intReadDat(void)(FILE*fp;inti=0;char*p;if((fp=fopen("eng?in","r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;}maxiine=i;fclose(fp);return0;)voidWriteDat(void){FILE*fp;inti;fp=fopen("ps6.out","w");for(i=0;i<maxiine;i++){printf("%s\n",xx[i]);fprintf(fp,"%s\n",xx[i]);}fclose(fp);}16函數(shù)ReadDat()實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)DelWordO分別按行刪除空格、標點符號以及!0個不區(qū)分大小寫的英文單詞(you,for,your,on,no,if,the,in,to,all),余下的單詞倒置后按順序重新存入數(shù)組xx中,最后調用函數(shù)WriteDat()把結果xx輸出到文件PS7.OUT中。例如:原文:Youareastudent.結果:eraatneduts原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PROG1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)mainO>讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<string.h>#include<conio.h>#include<ctype.h>charW0RD[10][10]={"you","for","your","on","no","if","the","in","to","all'};charxx[50][80];intmaxline=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidDelWord(void){int i,j,k,1;char line[80];char str[80];/*存放從xx中臨時取出的ー個單詞?/char* pch;for(i=0;i<50;i++){pch=xx[i];/?指針pch指向這一行的行首?/line[0]=0;k二〇;while(*pch){/?循環(huán)直到行結束?/尸〇;/?下面這個循環(huán)用于從當前行取出ー個單詞,并存放于str中?/while(isalpha(*pch))str[j++]=*pch++;str[j]=0;/*給字符串str補上〇?/if(str[0]){/?不空?//?循環(huán)和WORD中的單詞 比較?/for(1=0;1く10;1++){if(stricmp(str,WORD[1])==0)/*找到*/break;)if(l>=10)/?沒找到?/while(j)line[k++]=str[—j];/?單詞倒置放入line中?/}pch++;/?跳過空格?/)line[k]=0;/?給字符串line補上〇?/strcpy(xx[i],line);/?拷貝到xx[i]中*/)}voidmain(){cirscr();if(ReadDat()){printf(〃數(shù)據(jù)文件ENG.IN不能打開!、n\007〃);return;)DelWord();WriteDat();}intReadDat(void){FILE*fp;inti=0;char*p;if((fp=fopen("eng?in","r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;}maxline=i;fclose(fp);return0;}voidWriteDat(void)(FILE*fp;inti;fp=fopen("ps7.out","w");ford=0;i<maxiine;i++){printf("%s\n",xx[i]);fprintf(fp,"%s\n",xx[i]);}fclose(fp);17函數(shù)ReadDatO實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)DelWordO刪除整篇文章中的空格、標點符號以及單詞的長度為奇數(shù)的單詞,余下的單詞仍按行按順序重新存入數(shù)組xx中,最后調用函數(shù)WriteDat()把結果xx輸出到文件PS8.OUT中。例如:原文:Ifyoudonothaveauniquefield.結果:Ifdohaveunique原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PR0G1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDatO和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<string.h>#include<conio.h>^include<ctype.h>charxx[50][80];intmaxline=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidDelWord(void)(int i,j;char line[80];char str[80] ;/*存放從xx中臨時取出的ー個單詞?/char* pch;for(i=0;i<50;i++){pch=xx[i];/?指針pch指向這一行的行首?/line[0]=0;while(*pch){/?循環(huán)直到行結束?/j=0;/?下面這個循環(huán)用于從當前行取出ー個單詞,并存放于str中*/while(isalpha(*pch))str[j++]=*pch++;str[j]=0;/?給字符串str補上〇?/if(str[0]){/?不空?/if((j&l)=0)/?單詞長度為偶數(shù)?/strcat(line,str);pch++;/?跳過空格?/strcpy(xx[i],line);/?拷貝到xx[i]中*/voidmain(){clrscr();if(ReadDat()){printf(〃數(shù)據(jù)文件ENG.IN不能打開!、n\007");return;)DelWordO;WriteDat();}intReadDat(void)(FILE*fp;inti=0;char*p;if((fp=fopen("eng.in",r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n');if(p)xx[i][p-xx[i]]=0;i++;}maxline=i;fclose(fp);return0;)voidWriteDat(void)(FILE*fp;inti;fp=fopen("ps8.out","w");for(i=0;i<maxiine;i++){printf("%s\n",xx[i]);fprintf(fp,*%s\n*,xx[i])fclose(fp);)18函數(shù)ReadDatO實現(xiàn)從文件ENG.IN中讀取ー篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)DelWordO分別按行刪除在行中的空格、標點符號以及單詞的序數(shù)為偶數(shù)的單詞,余下的單詞仍按行按順序重新存入數(shù)組xx中,最后調用函數(shù)WriteDatO把結果xx輸出到文件PS9.OUT中。例如:原文:Ifyoudonothaveauniquefield.結果:Ifdohaveunique原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PROG1.C中。文章每行中的単詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDatO的內容。^include<stdio.h>#include<string.h>^include<conio.h>#include<ctype.h>charxx[50][80];intmaxline=0;/?文章的總行數(shù)?/intReadDat(void);voidWriteDat(void);voidDelWord(void)(int i,flag;char line[80];char *pch,*end;for(i=0;i<50;i++){pch=xx[i];/?指針pch指向這一行的行首?/line[0]=0;flagニ〇;/?標志:為〇二奇數(shù)行;非〇二偶數(shù)行?/while(*pch){/?循環(huán)直到行結束?/whi1e(!isalpha(*pch))pch++;/?過濾調前面的非字母?/for(end二pch;isalpha(*end);end++);/?指針end指向單詞的末尾?/*end=0;/?補ー個〇把單詞截斷?/if(*pch){/?不空?/if(flag==O)/?奇數(shù)行?/strcat(line,pch);flag='flag;/?對flag求反?/}pch=++end;/?下ー個單詞?/)strcpy(xx[i],line);/?拷貝到xx[i]中*/voidmain(){clrscr();if(ReadDat()){printf("數(shù)據(jù)文件ENGIN不能打開!'n\007");return;)DelWord();WriteDatO;intReadDat(void){FILE*fp;inti=0;char*p;if((fp=fopen<eng.in*,"r"))==NULL)return1;while(fgets(xx[i],80,fp)!=NULL){p=strchr(xx[i],'\n’);if(p)xx[i][p-xx[i]]=0;i++;)maxline=i;fclose(fp);return0;)voidWriteDat(void)FILE*fp;intifp=fopen(*ps9.out*,"w");for(i=0;i<maxiine;i++){printf(*%s\n*,xx[i]);fprintf(fp,"%s\n”,xx[i]);}fclose(fp);)19函數(shù)ReadDat()實現(xiàn)從文件ENG.IN中讀取一篇英文文章存入到字符串數(shù)組xx中;請編制函數(shù)DelWordO分別按行刪除在行中的空格、標點符號以及單詞的序數(shù)為奇數(shù)的單詞,余下的單詞倒置后仍按行按順序重新存入數(shù)組xx中,最后調用函數(shù)WriteDatO把結果xx輸出到文件PS10.OUT中。例如:原文:Ifyoudonothaveauniquefield.結果:uoytonadleif原始數(shù)據(jù)文件存放的格式是:每行的寬度均小于80個字符,含標點符號和空格。注意:部分源程序存放在PROG1.C中。文章每行中的單詞與單詞之間用空格或其它標點符號分隔,每單詞均小于20個字符。請勿改動主函數(shù)main。、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內容。#include<stdio.h>#include<string.h>

溫馨提示

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

評論

0/150

提交評論