日本一本亚洲最大|日本午夜免费啪视频在|国产自产在线视频一区|亚洲福利精品视频

    <object id="4ihfc"></object>
      
      
    1. <object id="4ihfc"></object>
    2. 我要投稿 投訴建議

      全國計算機(jī)等級四級機(jī)試試題及答案一(16-18)

      時間:2022-07-23 17:47:33 計算機(jī)等級 我要投稿
      • 相關(guān)推薦

      全國計算機(jī)等級四級機(jī)試試題及答案一(16-18)

      16./* 請編寫一個函數(shù)changestr(char *s),函數(shù)的功能是把s串中所有的字符前移一個位置,串中的第一個字符移到最后。
      例如:s串中原有的字符串為:Mn.123xyZ,則調(diào)用該函數(shù)后,s串中的內(nèi)容為:n.123xyZM。函數(shù)ReadWrite()實現(xiàn)從文件in3.dat中讀取兩個字符串,并調(diào)用函數(shù) changeStr(),最后把結(jié)果輸出到文件out3.dat中。
        注意:部分源程序存放在文件PROG1.C中。
        請勿改動主函數(shù)main()和其它函數(shù)中的任何內(nèi)容,僅在函數(shù)changeStr()的花括號中填入你編寫的若干語句。*/
      #include
      int cnt, sum ;
      void countValue()
      {
      }
      void main()
      {
      cnt = sum = 0 ;
      countValue() ;
      printf("素數(shù)的個數(shù)=%dn", cnt) ;
      printf("滿足條件素數(shù)值的和=%d", sum) ;
      writeDAT() ;
      }
      writeDAT()
      {
      FILE *fp ;
      fp = fopen("OUT6.DAT", "w") ;
      fprintf(fp, "%dn%dn", cnt, sum) ;
      fclose(fp) ;
      }
      17./* 請編制函數(shù)CalValue(),其功能要求是:1.求出這個文件中共有多少個正整數(shù)totNum;2.求這些數(shù)中的十位數(shù)位置上的數(shù)字2、4和8的數(shù)的
      個數(shù)totCnt;以及不滿足此條件的所有數(shù)的平均值totPjz,最后調(diào)用函數(shù)WriteDAT()把所求的結(jié)果輸出到文件out7.DAT中。
        注意:部分源程序存放在PROG1.C中。
        請勿改動主函數(shù)main(),讀數(shù)據(jù)函數(shù)ReadDAT()和輸出數(shù)據(jù)函數(shù)
      WriteDAT()的內(nèi)容。*/
      #include
      #include
      #define MAXNUM 200
      int xx[MAXNUM] ;
      int totNum = 0 ; /* 文件IN.DAT中共有多少個正整數(shù) */
      int totCnt = 0 ; /* 符合條件的正整數(shù)的個數(shù) */
      double totPjz = 0.0 ; /* 平均值 */
      int ReadDat(void) ;
      void WriteDat(void) ;
      void CalValue(void)
      {
      }
      void main()
      {
      clrscr() ;
      if(ReadDat()) {
      printf("數(shù)據(jù)文件IN.DAT不能打開!007n") ;
      return ;
      }
      CalValue() ;
      printf("文件IN.DAT中共有正整數(shù)=%d個n", totNum) ;
      printf("符合條件的正整數(shù)的個數(shù)=%d個n", totCnt) ;
      printf("平均值=%.2lfn", totPjz) ;
      WriteDat() ;
      }
      int ReadDat(void)
      {
      FILE *fp ;
      int i = 0 ;
      if((fp = fopen("in.dat", "r")) == NULL) return 1 ;
      while(!feof(fp)) {
      fscanf(fp, "%d,", &xx[i++]) ;
      }
      fclose(fp) ;
      return 0 ;
      }
      void WriteDat(void)
      {
      FILE *fp ;
      fp = fopen("OUT7.DAT", "w") ;
      fprintf(fp, "%dn%dn%.2lfn", totNum, totCnt, totPjz) ;
      fclose(fp) ;
      } http://krishna123.com/

      【全國計算機(jī)等級四級機(jī)試試題及答案一(16-18)】相關(guān)文章:

      全國計算機(jī)等級考試一級試題及答案08-07

      2017全國計算機(jī)等級考試一級試題及答案08-07

      2017全國計算機(jī)等級考試試題及答案08-07

      計算機(jī)等級考試試題及答案08-09

      全國計算機(jī)等級考試一級ms office試題08-09

      2017年計算機(jī)等級考試試題及答案08-08

      2016年全國計算機(jī)一級試題及答案08-05

      2014年計算機(jī)等級考試四級考試模擬試題08-10

      2017年江蘇省計算機(jī)等級考試試題及答案08-06

      全國計算機(jī)一級考試試題wps及答案08-05