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

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

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

        二級C程序修改(四)

        字號:

        ===========================================
            試題說明 :
            ===========================================
            函數fun的功能是:把a數組中的n個數和b數組中逆序的n個數
            一一相減,結果存在c數組中。
            例如: 當a數組中的值是:1、3、5、7、8
            b數組中的值是:2、3、4、5、8
            調用該函數后,c中存放的數據是:-7、-2、1、4、6
            注意: 部分源程序存在文件PROG1.C中。
            請勿改動主函數main和其它函數中的任何內容,僅在函數fun
            的花括號中填入你編寫的若干語句。
            ===========================================
            程序 :
            ===========================================
            #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 ( )
            {/* 本函數用于打開文件,輸入數據,調用函數,輸出數據,關閉文件。 */
            FILE *rf, *wf ;
            int a[100], b[100], c[100], i, j ;
            rf = fopen("in.dat", "r") ;
            wf = fopen("bc02.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) ;
            }
            ===========================================
            所需數據 :
            ===========================================
            @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 $BC02.DAT 005
            -9 -7 -5 -3 -1
            -7 -4 -1 2 6
            6 4 0 -3 0
            1 4 -1 -7 -1
            -5 -7 -7 5 4
            #E