1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #include<stdio.h>
void main()
{
int i,j,s,a[3][3];
int fun( int a[3][3]);
void TestFunc();
for (i=0;i<3;i++)
{
for (j=0;j<3;j++)
scanf ( "%d" ,&a[i][j]);
}
s=fun(a);
printf ( "Sum=%d\n" ,s);
TestFunc();
}
int fun( int a[3][3])
{
int sum;
int i,j;
_____1_____
for (_____2_____)
_____3_____
_____4_____
}
void TestFunc()
{
FILE *IN,*OUT;
int m;
int n;
int i[3][3];
int o;
IN= fopen ( "in.dat" , "r" );
if (IN==NULL)
{
printf ( "Read File Error" );
}
OUT= fopen ( "out.dat" , "w" );
if (OUT==NULL)
{
printf ( "Write File Error" );
}
for (m=0;m<3;m++)
{
for (n=0;n<3;n++)
fscanf (IN, "%d" ,&i[m][n]);
}
o=fun(i);
{
fprintf (OUT, "%d\n" ,o);
}
fclose (IN);
fclose (OUT);
}
|