久久久国产精品秘人口麻豆|永久免费AV无语国产|人成电影免费中文字幕|久久AV嫩草影院2

    1. <dfn id="yitbn"><samp id="yitbn"><progress id="yitbn"></progress></samp></dfn>

          <div id="yitbn"></div>

          1. 首頁 考試吧論壇 Exam8視線 考試商城 網(wǎng)絡(luò)課程 模擬考試 考友錄 實用文檔 求職招聘 論文下載
            2011中考 | 2011高考 | 2012考研 | 考研培訓 | 在職研 | 自學考試 | 成人高考 | 法律碩士 | MBA考試
            MPA考試 | 中科院
            四六級 | 職稱英語 | 商務(wù)英語 | 公共英語 | 托福 | 雅思 | 專四專八 | 口譯筆譯 | 博思 | GRE GMAT
            新概念英語 | 成人英語三級 | 申碩英語 | 攻碩英語 | 職稱日語 | 日語學習 | 法語 | 德語 | 韓語
            計算機等級考試 | 軟件水平考試 | 職稱計算機 | 微軟認證 | 思科認證 | Oracle認證 | Linux認證
            華為認證 | Java認證
            公務(wù)員 | 報關(guān)員 | 銀行從業(yè)資格 | 證券從業(yè)資格 | 期貨從業(yè)資格 | 司法考試 | 法律顧問 | 導游資格
            報檢員 | 教師資格 | 社會工作者 | 外銷員 | 國際商務(wù)師 | 跟單員 | 單證員 | 物流師 | 價格鑒證師
            人力資源 | 管理咨詢師考試 | 秘書資格 | 心理咨詢師考試 | 出版專業(yè)資格 | 廣告師職業(yè)水平
            駕駛員 | 網(wǎng)絡(luò)編輯
            衛(wèi)生資格 | 執(zhí)業(yè)醫(yī)師 | 執(zhí)業(yè)藥師 | 執(zhí)業(yè)護士
            會計從業(yè)資格考試會計證) | 經(jīng)濟師 | 會計職稱 | 注冊會計師 | 審計師 | 注冊稅務(wù)師
            注冊資產(chǎn)評估師 | 高級會計師 | ACCA | 統(tǒng)計師 | 精算師 | 理財規(guī)劃師 | 國際內(nèi)審師
            一級建造師 | 二級建造師 | 造價工程師 | 造價員 | 咨詢工程師 | 監(jiān)理工程師 | 安全工程師
            質(zhì)量工程師 | 物業(yè)管理師 | 招標師 | 結(jié)構(gòu)工程師 | 建筑師 | 房地產(chǎn)估價師 | 土地估價師 | 巖土師
            設(shè)備監(jiān)理師 | 房地產(chǎn)經(jīng)紀人 | 投資項目管理師 | 土地登記代理人 | 環(huán)境影響評價師 | 環(huán)保工程師
            城市規(guī)劃師 | 公路監(jiān)理師 | 公路造價師 | 安全評價師 | 電氣工程師 | 注冊測繪師 | 注冊計量師
            繽紛校園 | 實用文檔 | 英語學習 | 作文大全 | 求職招聘 | 論文下載 | 訪談 | 游戲

            計算機等級考試三級C語言上機試題總結(jié)

            英文文章——字符串處理(共10題)之一

            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)SortCharD( ), 其函數(shù)的功能是: 以行為單位對字符按從大到小的順序進行排序, 排序后的結(jié)果仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT2.DAT中。
            例: 原文: dAe,BfC.
            CCbbAA
            結(jié)果: fedCBA.,
            bbCCAA
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include <stdio.h>
            #include <string.h>
            #include <conio.h>

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void SortCharD(void)
            {/**/
            int i,j,k,m,n; char ch;
            for(i=0; i < maxline; i++)
            { j=strlen(xx[i]);
            for(m=0; m < j-1; m++)
            { k=m;
            for(n=m+1; n < j; n++)
            if(xx[i][k] < xx[i][n]) k=n;
            if(k!=m)
            { ch=xx[i][k]; xx[i][k]=xx[i][m]; xx[i][m]=ch; }
            }
            }

            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            SortCharD() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT2.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }


            in.dat 文件內(nèi)容為:
            You can create an index on any field, on several fields to be
            used
            together, or on parts thereof, that you want to use as a key.
            The
            keys in indexes allow you quick access to specific records and
            define
            orders for sequential processing of a ISAM file. After you no
            longer
            need an index, you can delete it. Addition and indexes have no
            effect
            on the data records or on other indexes.
            You may want a field in field in each record to uniquely
            identify that
            record from all other records in the file. For example, the
            Employee
            Number field is unique if you do not assign the same number to
            two
            different employees, and you never reassign these numbers to
            other
            employees. If you wish to find or modify the record belonging
            to a
            specific employee, this unique field saves the thouble of
            determining
            whether you have the correct record.
            If you do not have a unique field, you must find the first
            record
            the matches your key and determine whether the record is the
            one you
            want. If it is not the correct one, you must search again to
            find others.
            If you know that you have a unique field within your records,
            you
            can include this fact in the key description, and ISAM will
            allow only
            unique keys. For example, if you specify that the employee
            numbers are
            unique, ISAM only lets you add records to the file for, or
            change
            numbers to, employee numbers that do not alreadly exist int
            file.

            out2.dat 文件內(nèi)容應當為:
            yxvuuttsssrroooonnnnnnllliiiffeeeeeeeeeddddccbaaaaaY,
            yywuuttttttttsssrrrrpoooooonnkhhhhgfeeeeeeeaaaaaT.,,
            yyxwuutssssssrrqpoooonnnnllkkiiiiiiffeeeeeeeeddddccccccaaa
            yuuttssssrrrrrrqpooooooonnnnllliiiggffffeeeeeeedcaaSMIAA.
            yxxvuttttsooonnnnnnnnliiiiihffeeeeeeeeeeedddddddccaaaaA.,
            xtttssrrrrooooonnnihheeeeedddcaa.
            yyywuuutttttrrqooonnnnnmllliiiiiiihhfffeeeeeeddddccaaaaaY
            yxtttsrrrrrrrppoooooonmmmllllliihhhffeeeeeeeeeeddccaaFE.,
            ywuuuuuttttssssrrqooooonnnnmmmliiiiihgffeeeeeeddbbaaN
            yyvuuttttsssssrrrrrpoooonnnnnmmliihhgffeeeeeeeeeeeeddbaa,
            yyywutttssrrrpoooooooonnnmmlliiiihhggfffeeeeeedddcbaI.
            yvuuuttttssssrqppooonnnmmllliiiiiiihhhgfffeeeeeeeeeeeddccba,
            ywvutttrrrrrooohhhheeeeeedccca.
            yyvuuuuuttttssrrrqooooonnnmliiiihhffffeeeeeddddcaaI,
            yyywuuttttttssrrrrroooonnnmmkiihhhhhheeeeeeeeeeeedddccaa
            ywuuttttttttssssrrrroooooonnnnnmiiiihhhgffeeeeedcccaaaaI..,
            yyyywwvuuuuuutttsrrrqoooooonnnlkiiiihhhffeeeeddcaaaI,
            yywwuttttssrpooonnnnnnllllllkiiiiiihhfeeeedddccccaaaaSMIA,
            yyyyxuuuutttsssrrrqpppooonnmmmllkiiihhffeeeeeeeeeeecbaaaF.,
            yyuuutttssrrrrqoooooonnnllliihhgffeeeeeedddccaaSMIA,,
            yyxuuttttttsssrrrpoooonnnnmmmlllliiihfeeeeeeeeddbbaaa.,


            字符串處理之二
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)ConvertCharA(), 其函數(shù)的功能是: 以行為單位把字符串中的所有小寫字母改寫成該字母的下一個字母, 如果是字母z, 則改寫成字母a,大寫字母和其它字符保持不變。把已處理的字符串仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT3.DAT中。
            例: 原文: Adb.Bcdza
            abck.LLhj
            結(jié)果: Aec.Bdeab
            bcdl.LLik
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include
            #include
            #include

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void ConvertCharA(void)
            {/**/
            int i,j;
            for(i=0; i < maxline; i++)
            for(j=0; j < strlen(xx[i]); j++)
            if(xx[i][j]=='z') xx[i][j]='a';
            else if((xx[i][j]>='a')&&(xx[i][j]<'z')) xx[i][j]++;
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            ConvertCharA() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT3.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }


            out3.dat文件內(nèi)容應當如下:
            Ypv dbo dsfbuf bo joefy po boz gjfme, po tfwfsbm gjfmet up cf
            vtfe
            uphfuifs, ps po qbsut uifsfpg, uibu zpv xbou up vtf bt b lfz.
            Tif
            lfzt jo joefyft bmmpx zpv rvjdl bddftt up tqfdjgjd sfdpset boe
            efgjof
            psefst gps tfrvfoujbm qspdfttjoh pg b ISAM gjmf. Agufs zpv op
            mpohfs
            offe bo joefy, zpv dbo efmfuf ju. Aeejujpo boe joefyft ibwf op
            fggfdu
            po uif ebub sfdpset ps po puifs joefyft.
            Ypv nbz xbou b gjfme jo gjfme jo fbdi sfdpse up vojrvfmz
            jefoujgz uibu
            sfdpse gspn bmm puifs sfdpset jo uif gjmf. Fps fybnqmf, uif
            Enqmpzff
            Nvncfs gjfme jt vojrvf jg zpv ep opu bttjho uif tbnf ovncfs up
            uxp
            ejggfsfou fnqmpzfft, boe zpv ofwfs sfbttjho uiftf ovncfst up
            puifs
            fnqmpzfft. Ig zpv xjti up gjoe ps npejgz uif sfdpse cfmpohjoh
            up b
            tqfdjgjd fnqmpzff, uijt vojrvf gjfme tbwft uif uipvcmf pg
            efufsnjojoh
            xifuifs zpv ibwf uif dpssfdu sfdpse.
            Ig zpv ep opu ibwf b vojrvf gjfme, zpv nvtu gjoe uif gjstu
            sfdpse
            uif nbudift zpvs lfz boe efufsnjof xifuifs uif sfdpse jt uif
            pof zpv
            xbou. Ig ju jt opu uif dpssfdu pof, zpv nvtu tfbsdi bhbjo up
            gjoe puifst.
            Ig zpv lopx uibu zpv ibwf b vojrvf gjfme xjuijo zpvs sfdpset,
            zpv
            dbo jodmvef uijt gbdu jo uif lfz eftdsjqujpo, boe ISAM xjmm
            bmmpx pomz
            vojrvf lfzt. Fps fybnqmf, jg zpv tqfdjgz uibu uif fnqmpzff
            ovncfst bsf
            vojrvf, ISAM pomz mfut zpv bee sfdpset up uif gjmf gps, ps
            dibohf
            ovncfst up, fnqmpzff ovncfst uibu ep opu bmsfbemz fyjtu jou
            gjmf.

            字符串處理之三
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)SortCharA( ), 其函數(shù)的功能是: 以行為單位對字符按從小到大的順序進行排序, 排序后的結(jié)果仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT1.DAT中。
            例: 原文: dAe,BfC.
            CCbbAA
            結(jié)果: ,.ABCdef
            AACCbb
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include
            #include
            #include

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void SortCharA(void)
            {/**/
            int i,j,k,m,n; char ch;
            for(i=0; i < maxline; i++)
            { j=strlen(xx[i]);
            for(m=0; m < j-1; m++)
            { k=m;
            for(n=m+1; n < j; n++)
            if(xx[i][k] > xx[i][n]) k=n;
            if(k!=m)
            { ch=xx[i][k]; xx[i][k]=xx[i][m]; xx[i][m]=ch; }
            }
            }
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            SortCharA() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT1.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            out1.dat 文件內(nèi)容如下(注意每行的前面有若干空格):
            ,Yaaaaabccddddeeeeeeeeeffiiilllnnnnnnoooorrsssttuuvxy
            ,,.Taaaaaeeeeeeefghhhhknnooooooprrrrsssttttttttuuwyy
            aaaccccccddddeeeeeeeeffiiiiiikkllnnnnoooopqrrsssssstuuwxyy
            .AAIMSaacdeeeeeeeffffggiiilllnnnnooooooopqrrrrrrssssttuuy
            ,.Aaaaaccdddddddeeeeeeeeeeeffhiiiiilnnnnnnnnooosttttuvxxy
            .aacdddeeeeehhinnnooooorrrrsstttx
            Yaaaaaccddddeeeeeefffhhiiiiiiilllmnnnnnoooqrrtttttuuuwyyy
            ,.EFaaccddeeeeeeeeeeffhhhiilllllmmmnoooooopprrrrrrrstttxy
            Naabbddeeeeeeffghiiiiilmmmnnnnoooooqrrssssttttuuuuuwy
            ,aabddeeeeeeeeeeeeffghhiilmmnnnnnooooprrrrrsssssttttuuvyy
            .Iabcdddeeeeeefffgghhiiiillmmnnnooooooooprrrsstttuwyyy
            ,abccddeeeeeeeeeeefffghhhiiiiiiilllmmnnnoooppqrssssttttuuuvy
            .acccdeeeeeehhhhooorrrrrtttuvwy
            ,Iaacddddeeeeeffffhhiiiilmnnnoooooqrrrssttttuuuuuvyy
            aaccdddeeeeeeeeeeeehhhhhhiikmmnnnoooorrrrrssttttttuuwyyy
            ,..Iaaaacccdeeeeeffghhhiiiimnnnnnoooooorrrrssssttttttttuuwy
            ,Iaaacddeeeeffhhhiiiiklnnnooooooqrrrstttuuuuuuvwwyyyy
            ,AIMSaaaaccccdddeeeefhhiiiiiikllllllnnnnnnoooprssttttuwwyy
            ,.Faaabceeeeeeeeeeeffhhiiikllmmmnnooopppqrrrssstttuuuuxyyyy
            ,,AIMSaaccdddeeeeeeffghhiilllnnnooooooqrrrrsstttuuuyy
            ,.aaabbddeeeeeeeefhiiillllmmmnnnnooooprrrsssttttttuuxyy

            字符串處理之四
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)StrCharJL( ), 其函數(shù)的功能是: 以行為單位把字符串中的所有字符的ASCII值左移4位, 如果左移后,其字符的ASCII值小于等于32或大于100, 則原字符保持不變, 否則就把左移后的字符ASCII值再加上原字符的ASCII值, 得到新的字符仍存入原字符串對應的位置上,之后把已處理的字符串仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到OUT7.DAT文件中。
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include
            #include
            #include

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void StrCharJL(void)
            {/**/
            int i,j; char m;
            /****老王注:此題的關(guān)鍵是定義 char m 。記得往年的考試類似題可以不必定義,如果要定義的話,則必須定義為 int 結(jié)果才能正確?磥砝斫獬鲱}者的意圖是機試的難點之一。 ****/
            for(i=0; i < maxline; i++)
            for(j=0; j < strlen(xx[i]); j++)
            { m=xx[i][j]<<4;
            if((m>32)&&(m<=100))
            xx[i][j]+=m;
            }
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            StrCharJL() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT7.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            字符串處理之五
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)StrCharJR( ), 其函數(shù)的功能是: 以行為單位把字符串中的所有字符的ASCII值右移4位, 然后把右移后的字符ASCII值再加上原字符的ASCII值, 得到新的字符仍存入原字符串對應的位置上,之后把已處理的字符串仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT8.DAT中。
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include
            #include
            #include

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void StrCharJR(void)
            {/**/
            int i,j;
            for(i=0; i
            for(j=0; j
            xx[i][j]+=xx[i][j]>>4;
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            StrCharJR() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT8.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            out8.dat 文件內(nèi)容應當如下:
            ^u|"igt"iykg{k"gt"otjk"ut"gt"lokrj."ut"zk}kygr"lokrjz"{u"hk"|zkj

            {umk{nky."uy"ut"wgy{z"{nkykul."{ng{"u|"~gt{"{u"|zk"gz"g"qk0"Ynk

            qkz"ot"otjkkz"grru~"u|"x|oiq"giikzz"{u"zwkioloi"ykiuyjz"gtj"jklotk

            uyjkyz"luy"zkx|kt{ogr"wyuikzzotm"ul"g"MXEQ"lork0"El{ky"u|"tu"rutmky

            tkkj"gt"otjk."u|"igt"jkrk{k"o{0"Ejjo{out"gtj"otjkkz"ng}k"tu"kllki{

            ut"{nk"jg{g"ykiuyjz"uy"ut"u{nky"otjkkz0
            ^u|"sg"~gt{"g"lokrj"ot"lokrj"ot"kgin"ykiuyj"{u"|tox|kr"ojkt{ol"{ng{

            ykiuyj"lyus"grr"u{nky"ykiuyjz"ot"{nk"lork0"Juy"kgswrk."{nk"Iswrukk

            R|shky"lokrj"oz"|tox|k"ol"u|"ju"tu{"gzzomt"{nk"zgsk"t|shky"{u"{~u

            jollkykt{"kswrukkz."gtj"u|"tk}ky"ykgzzomt"{nkzk"t|shkyz"{u"u{nky

            kswrukkz0"Ml"u|"~ozn"{u"lotj"uy"sujol"{nk"ykiuyj"hkrutmotm"{u"g

            zwkioloi"kswrukk."{noz"|tox|k"lokrj"zg}kz"{nk"{nu|hrk"ul"jk{kysototm

            ~nk{nky"u|"ng}k"{nk"iuyyki{"ykiuyj0
            Ml"u|"ju"tu{"ng}k"g"|tox|k"lokrj."u|"s|z{"lotj"{nk"loyz{"ykiuyj

            {nk"sg{inkz"u|y"qk"gtj"jk{kysotk"~nk{nky"{nk"ykiuyj"oz"{nk"utk"u|

            ~gt{0"Ml"o{"oz"tu{"{nk"iuyyki{"utk."u|"s|z{"zkgyin"gmgot"{u"lotj"u{nkyz0

            Ml"u|"qtu~"{ng{"u|"ng}k"g"|tox|k"lokrj"~o{not"u|y"ykiuyjz."u|

            igt"otir|jk"{noz"lgi{"ot"{nk"qk"jkziyow{out."gtj"MXEQ"~orr"grru~"utr

            |tox|k"qkz0"Juy"kgswrk."ol"u|"zwkiol"{ng{"{nk"kswrukk"t|shkyz"gyk

            |tox|k."MXEQ"utr"rk{z"u|"gjj"ykiuyjz"{u"{nk"lork"luy."uy"ingtmk

            t|shkyz"{u."kswrukk"t|shkyz"{ng{"ju"tu{"grykgjr"koz{"ot{"lork0


            字符串處理之六
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)StrOL( ), 其函數(shù)的功能是: 以行為單位對行中以空格或標點符號為分隔的所有單詞進行倒排,同時去除標點符號,之后把已處理的字符串(應不含標點符號)仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT6.DAT中。
            例如: 原文: You He Me
            I am a student.
            結(jié)果: Me He You
            student a am I
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。

            **** 同1998年3B第六題 ****
            */
            #include <stdio.h>
            #include <string.h>
            #include <conio.h>
            #include <ctype.h>

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void StrOL(void)
            {/**/
            int i,j,k,m,n,ll;
            char yy[80];
            for(i=0; i < maxline; i++)
            { ll=strlen(xx[i]); k=n=0;
            for(j=ll-1; j>=0; j--)
            { if(isalpha(xx[i][j])) k++;
            else
            { for(m=1; m<=k; m++)
            yy[n++]=xx[i][j+m];
            k=0;
            }
            if(xx[i][j]==' ') yy[n++]=' ';
            }
            for(m=1; m<=k; m++)
            yy[n++]=xx[i][j+m];
            /* 上面兩行處理每行的第一個單詞。
            如果漏寫,結(jié)果顯然不正確,但并不影響得分。 */
            yy[n]=0;
            strcpy(xx[i],yy);
            }
            /* 標準答案與此法結(jié)果相比,每行后面多一個空格。 */
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            StrOL() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT6.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            out6.dat 內(nèi)容應當如下:
            used be to fields several on field any on index an create can
            You
            The key a as use to want you that thereof parts on or together

            define and records specific to access quick you allow indexes
            in keys
            longer no you After file ISAM a of processing sequential for
            orders
            effect no have indexes and Addition it delete can you index an
            need
            indexes other on or records data the on
            that identify uniquely to record each in field in field a want
            may You
            Employee the example For file the in records other all from
            record
            two to number same the assign not do you if unique is field
            Number
            other to numbers these reassign never you and employees
            different
            a to belonging record the modify or find to wish you If
            employees
            determining of thouble the saves field unique this employee
            specific
            record correct the have you whether
            record first the find must you field unique a have not do you
            If
            you one the is record the whether determine and key your
            matches the
            others find to again search must you one correct the not is it
            If want
            you records your within field unique a have you that know you
            If
            only allow will ISAM and description key the in fact this
            include can
            are numbers employee the that specify you if example For keys
            unique
            change or for file the to records add you lets only ISAM
            unique
            file int exist alreadly not do that numbers employee to
            numbers

            字符串處理之七
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)ConvertCharD(), 其函數(shù)的功能是: 以行為單位把字符串中的所有小寫字母改寫成該字母的上一個字母, 如果是字母a, 則改寫成字母z,大寫字母和其它字符保持不變。把已處理的字符串仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT4.DAT中。
            例: 原文: Adb.Bcdza
            abck.LLhj
            結(jié)果: Aca.Bbcyz
            zabj.LLgi
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include <stdio.h>
            #include <string.h>
            #include <conio.h>

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void ConvertCharD(void)
            {/**/
            int i,j;
            for(i=0; i < maxline; i++)
            for(j=0; j < strlen(xx[i]); j++)
            if(xx[i][j]=='a') xx[i][j]='z';
            else if(islower(xx[i][j])) xx[i][j]-=1;
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            ConvertCharD() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT4.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            out4.dat 文件內(nèi)容應當如下:
            Ynt bzm bqdzsd zm hmcdw nm zmx ehdkc, nm rdudqzk ehdkcr sn ad
            trdc
            snfdsgdq, nq nm ozqsr sgdqdne, sgzs xnt vzms sn trd zr z jdx.
            Tgd
            jdxr hm hmcdwdr zkknv xnt pthbj zbbdrr sn rodbhehb qdbnqcr zmc
            cdehmd
            nqcdqr enq rdptdmshzk oqnbdrrhmf ne z ISAM ehkd. Aesdq xnt mn
            knmfdq
            mddc zm hmcdw, xnt bzm cdkdsd hs. Acchshnm zmc hmcdwdr gzud mn
            deedbs
            nm sgd czsz qdbnqcr nq nm nsgdq hmcdwdr.
            Ynt lzx vzms z ehdkc hm ehdkc hm dzbg qdbnqc sn tmhptdkx
            hcdmshex sgzs
            qdbnqc eqnl zkk nsgdq qdbnqcr hm sgd ehkd. Fnq dwzlokd, sgd
            Eloknxdd
            Ntladq ehdkc hr tmhptd he xnt cn mns zrrhfm sgd rzld mtladq sn
            svn
            cheedqdms dloknxddr, zmc xnt mdudq qdzrrhfm sgdrd mtladqr sn
            nsgdq
            dloknxddr. Ie xnt vhrg sn ehmc nq lnchex sgd qdbnqc adknmfhmf
            sn z
            rodbhehb dloknxdd, sghr tmhptd ehdkc rzudr sgd sgntakd ne
            cdsdqlhmhmf
            vgdsgdq xnt gzud sgd bnqqdbs qdbnqc.
            Ie xnt cn mns gzud z tmhptd ehdkc, xnt ltrs ehmc sgd ehqrs
            qdbnqc
            sgd lzsbgdr xntq jdx zmc cdsdqlhmd vgdsgdq sgd qdbnqc hr sgd
            nmd xnt
            vzms. Ie hs hr mns sgd bnqqdbs nmd, xnt ltrs rdzqbg zfzhm sn
            ehmc nsgdqr.
            Ie xnt jmnv sgzs xnt gzud z tmhptd ehdkc vhsghm xntq qdbnqcr,
            xnt
            bzm hmbktcd sghr ezbs hm sgd jdx cdrbqhoshnm, zmc ISAM vhkk
            zkknv nmkx
            tmhptd jdxr. Fnq dwzlokd, he xnt rodbhex sgzs sgd dloknxdd
            mtladqr zqd
            tmhptd, ISAM nmkx kdsr xnt zcc qdbnqcr sn sgd ehkd enq, nq
            bgzmfd
            mtladqr sn, dloknxdd mtladqr sgzs cn mns zkqdzckx dwhrs hms
            ehkd.

            字符串處理之八
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)CharConvA( ), 其函數(shù)的功能是: 以行為單位把字符串中的最后一個字符的ASCII值右移4位后加最后第二個字符的ASCII值, 得到最后一個新的字符, 最后第二個字符的ASCII值右移4位后加最后第三個字符的ASCII值,得到最后第二個新的字符, 以此類推一直處理到第二個字符, 第一個字符的ASCII值加原最后一個字符的ASCII值, 得到第一個新的字符, 得到的新字符分別存放在原字符串對應的位置上,之后把已處理的字符串仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT10.DAT中。

            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include <stdio.h>
            #include <string.h>
            #include <conio.h>

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void CharConvA(void)
            {/**/
            int i,j,ll; char ch;
            for(i=0; i < maxline; i++)
            { ll=strlen(xx[i]); ch=xx[i][ll-1];
            for(j=ll-1; j; j--)
            xx[i][j]=(xx[i][j]>>4)+xx[i][j-1];
            xx[i][0]+=ch;
            }
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            CharConvA() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT10.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            字符串處理之9
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)StrOR( ), 其函數(shù)的功能是: 以行為單位依次把字符串中所有小寫字母o 左邊的字符串內(nèi)容移到該串的右邊存放, 然后并把小寫字母o刪除,余下的字符串內(nèi)容移到已處理字符串的左邊存放,之后把已處理的字符串仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT5.DAT中。
            例如: 原文: You can create an index on any field.
            you have the correct record.
            結(jié)果: n any field. Yu can create an index
            rd. yu have the crrect rec
            原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。

            */
            #include <stdio.h>
            #include <string.h>
            #include <conio.h>

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void StrOR(void)
            {/**/
            int i,j; char yy[80],*p;
            for(i=0; i
            for(j=0; j
            if(xx[i][j]=='o')
            { p=&xx[i][j+1];
            strcpy(yy,p);
            strncat(yy,xx[i],j);
            strcpy(xx[i],yy);
            j=0;
            }
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            StrOR() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT5.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            out5.dat 文件內(nèi)容應當如下:

            be usedYu can create an index n any field, n several fields t
            use as a key. Thetgether, r n parts theref, that yu want t
            rds and definekeys in indexes allw yu quick access t specific
            rec
            ngerrders fr sequential prcessing f a ISAM file. After yu n l
            effectneed an index, yu can delete it. Additin and indexes
            have n
            ther indexes.n the data recrds r n
            uniquely identify thatYu may want a field in field in each
            recrd t
            yeerecrd frm all ther recrds in the file. Fr example, the Empl

            Number field is unique if yu d nt assign the same number t tw
            therdifferent emplyees, and yu never reassign these numbers t
            aemplyees. If yu wish t find r mdify the recrd belnging t
            f determiningspecific emplyee, this unique field saves the
            thuble
            rd.whether yu have the crrect rec
            rdIf yu d nt have a unique field, yu must find the first rec
            uthe matches yur key and determine whether the recrd is the ne
            y
            thers.want. If it is nt the crrect ne, yu must search again t
            find
            uIf yu knw that yu have a unique field within yur recrds, y
            nlycan include this fact in the key descriptin, and ISAM will
            allw
            yee numbers areunique keys. Fr example, if yu specify that the
            empl
            r changeunique, ISAM nly lets yu add recrds t the file fr,
            t alreadly exist int file.numbers t, emplyee numbers that d n

            字符串處理之10
            code:
            /*
            函數(shù)ReadDat( )實現(xiàn)從文件IN.DAT中讀取一篇英文文章存入到字符串數(shù)組xx中; 請編制函數(shù)ChA( ), 其函數(shù)的功能是: 以行為單位把字符串中的第一個字符的ASCII值加第二個字符的ASCII值, 得到第一個新的字符, 第二個字符的ASCII值加第三個字符的ASCII值,得到第二個新的字符, 以此類推一直處理到最后第二個字符, 最后一個字符的ASCII值加原第一個字符的ASCII值, 得到最后一個新的字符, 得到的新字符分別存放在原字符串對應的位置上,之后把已處理的字符串逆轉(zhuǎn)后仍按行重新存入字符串數(shù)組xx中。最后main()函數(shù)調(diào)用函數(shù)WriteDat()把結(jié)果xx輸出到文件OUT9.DAT中。原始數(shù)據(jù)文件存放的格式是: 每行的寬度均小于80個字符, 含標點符號和空格。

            注意: 部分源程序存放在PROG1.C中。
            請勿改動主函數(shù)main( )、讀數(shù)據(jù)函數(shù)ReadDat()和輸出數(shù)據(jù)函數(shù)WriteDat()的內(nèi)容。
            */
            #include <stdio.h>
            #include <string.h>
            #include <conio.h>

            char xx[50][80] ;
            int maxline = 0 ; /* 文章的總行數(shù) */

            int ReadDat(void) ;
            void WriteDat(void) ;

            void ChA(void)
            {/**/
            int i,j; char ch;
            for(i=0; i < maxline; i++)
            { ch=xx[i][0];
            for(j=0; j < strlen(xx[i])-1; j++)
            xx[i][j]+=xx[i][j+1];
            xx[i][j]+=ch;
            strrev(xx[i]);
            }
            /**/
            }

            void main()
            {
            clrscr() ;
            if(ReadDat()) {
            printf("數(shù)據(jù)文件IN.DAT不能打開!\n\007") ;
            return ;
            }
            ChA() ;
            WriteDat() ;
            }

            int ReadDat(void)
            {
            FILE *fp ;
            int i = 0 ;
            char *p ;

            if((fp = fopen("IN.DAT", "r")) == NULL) return 1 ;
            while(fgets(xx[i], 80, fp) != NULL) {
            p = strchr(xx[i], '\n') ;
            if(p) *p = 0 ;
            i++ ;
            }
            maxline = i ;
            fclose(fp) ;
            return 0 ;
            }

            void WriteDat(void)
            {
            FILE *fp ;
            int i ;

            clrscr() ;
            fp = fopen("OUT9.DAT", "w") ;
            for(i = 0 ; i < maxline ; i++) {
            printf("%s\n", xx[i]) ;
            fprintf(fp, "%s\n", xx[i]) ;
            }
            fclose(fp) ;
            }

            文章搜索
            版權(quán)聲明:如果計算機等級考試網(wǎng)所轉(zhuǎn)載內(nèi)容不慎侵犯了您的權(quán)益,請與我們聯(lián)系800@eeeigo.com,我們將會及時處理。如轉(zhuǎn)載本計算機等級考試網(wǎng)內(nèi)容,請注明出處。