亚洲欧洲国产欧美一区精品,激情五月亚洲色五月,最新精品国偷自产在线婷婷,欧美婷婷丁香五月天社区

      考試首頁 | 考試用書 | 培訓(xùn)課程 | 模擬考場(chǎng) | 考試論壇  
      全國(guó)  |             |          |          |          |          |         
        當(dāng)前位置:計(jì)算機(jī)等級(jí) > 二級(jí)考試 > C語言程序設(shè)計(jì) > C語言模擬試題 > 文章內(nèi)容
        

      全國(guó)計(jì)算機(jī)二級(jí)考試C語言試題與答案精選第四套(程序改錯(cuò))

      中華IT學(xué)院   【 】  [ 2016年7月11日 ]

      程序改錯(cuò)

      功能:一個(gè)5位數(shù),判斷它是不是回文數(shù)。即12321是回文數(shù),個(gè)

            位與萬位相同,十位與千位相同。

       

      ------------------------------------------------------*/

       

      #include "stdio.h"

      main( )

      {

        /**********ERROR**********/

        long ge,shi,qian;wan,x;

        scanf("%ld",&x);

        /**********ERROR**********/

        wan=x000;

        qian=x000/1000;

        shi=x0/10;

        ge=x;

        /**********ERROR**********/

        if (ge==wan||shi==qian)

          printf("this number is a huiwen\n");

        else

          printf("this number is not a huiwen\n");

      }

      改:long ge,shi,qian,wan,x;

          wan=x/10000;

      if (ge==wan&&shi==qian)

       

       

       

      /*------------------------------------------------------       

      【程序改錯(cuò)】

      --------------------------------------------------------

       

      功能:用下面的和式求圓周率的近似值。直到最后一項(xiàng)的絕對(duì)值

            小于等于0.0001。

         

         π/4= 1- 1/3 + 1/5 - 1/7 ....

       

           

      ------------------------------------------------------*/

      #include "stdio.h"

      /**********ERROR**********/

      #include "math"

       

      void fun()

      {

           float s=0,t=1,i=1;

        /**********ERROR**********/

           int  p=1;

        /**********ERROR**********/

        while(fabs(t)<=1e-4)

        {

          s=s+t;

          p=-p;

          i=i+2;

          t=p/i;

        }

        /**********ERROR**********/

        printf("pi=%d\n",s*4);

      }

       

      main()

      {

        fun();

      改:#include "math.h"

      float  p=1;

                while(fabs(t)>1e-4)

      while(0.0001

      while(1e-4

      while(fabs(t)>0.0001)

       

      分享到:
      本文糾錯(cuò)】【告訴好友】【打印此文】【返回頂部
      將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動(dòng)訪問考試網(wǎng) | 復(fù)制本頁地址,傳給QQ/MSN上的好友 | 申請(qǐng)鏈接 | 意見留言 TOP
      關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
      Copyright © 2006-2017 中華考試網(wǎng)(Examw.com) All Rights Reserved  營(yíng)業(yè)執(zhí)照