亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        二級(jí)C程序設(shè)計(jì)(二)

        字號(hào):

        試題說明 :
            ===========================================
            函數(shù)fun的功能是:把a(bǔ)數(shù)組中的n個(gè)數(shù)和b數(shù)組中逆序的n個(gè)數(shù)
            一一對(duì)應(yīng)相加、求平方,結(jié)果存放在c數(shù)組中。
            例如:
            若a數(shù)組中的值是:1、3、5、7、8
            b數(shù)組中的值是:2、3、4、5、8
            調(diào)用該函數(shù)后,c中存放的數(shù)據(jù)是81、64、81、100、100
            注意: 部分源程序存在文件PROG1.C中。
            請(qǐng)勿改動(dòng)主函數(shù)main和其它函數(shù)中的任何內(nèi)容,僅在函數(shù)fun
            的花括號(hào)中填入你編寫的若干語句。
            ===========================================
            程序 :
            ===========================================
            #include
            #include
            void fun(int a[], int b[], int c[], int n)
            {
            }
            main()
            { int i, a[100]={1,3,5,7,8}, b[100]={2,3,4,5,8}, c[100];
            clrscr();
            fun(a, b, c, 5);
            printf("The result is: ");
            for (i=0; i<5; i++) printf("%d ", c[i]);
            printf("\n");
            NONO();
            }
            NONO ( )
            {/* 本函數(shù)用于打開文件,輸入數(shù)據(jù),調(diào)用函數(shù),輸出數(shù)據(jù),關(guān)閉文件。 */
            FILE *rf, *wf ;
            int a[100], b[100], c[100], i, j ;
            rf = fopen("in.dat", "r") ;
            wf = fopen("bc04.dat","w") ;
            for(i = 0 ; i < 5 ; i++) {
            for(j = 0 ; j < 5 ; j++) fscanf(rf, "%d,", &a[j]) ;
            for(j = 0 ; j < 5 ; j++) fscanf(rf, "%d,", &b[j]) ;
            fun(a, b, c, 5) ;
            for(j = 0 ; j < 5 ; j++) fprintf(wf, "%d ", c[j]) ;
            fprintf(wf, "\n") ;
            }
            fclose(rf) ;
            fclose(wf) ;
            }
            ===========================================
            所需數(shù)據(jù) :
            ===========================================
            @2 IN.DAT 010
            1,2,3,4,5
            6,7,8,9,10
            2,3,5,6,7
            1,4,6,7,9
            11,7,2,4,8
            8,7,2,3,5
            9,10,3,4,7
            8,11,4,6,8
            4,3,1,9,7
            3,4,8,10,9
            #E
            @3 $BC04.DAT 005
            121 121 121 121 121
            121 100 121 100 64
            256 100 16 121 256
            289 256 49 225 225
            169 169 81 169 100
            #E