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 | #include<stdio.h>
long fun( long s, long t)
{
long sl=10;
_____1_____
_____2_____
while (_____3_____)
{
_____4_____
_____5_____
_____6_____
}
return t;
}
void main()
{
long s, t,m;
void TestFunc();
printf ( "\nPlease enter s:" );
scanf ( "%ld" , &s);
m=fun(s,t);
printf ( "The result is: %ld\n" , m);
TestFunc();
}
void TestFunc()
{
FILE *IN,*OUT;
int n;
long i,t,m;
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 (n=0;n<5;n++)
{
fscanf (IN, "%ld" ,&i);
m=fun(i,t);
fprintf (OUT, "%ld\n" ,m);
}
fclose (IN);
fclose (OUT);
}
|