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 | #include<stdio.h>
#include<conio.h>
int fun( int w)
{
int k,s=0;
do {
_____1_____
_____2_____
}
while (_____3_____)
if (_____4_____)
_____5_____
else_____6_____
return k;
}
void main()
{
int m;
void TestFunc();
printf ( "Enter m: " );
scanf ( "%d" , &m);
printf ( "\nThe result is %d\n" , fun(m));
TestFunc();
}
void TestFunc()
{
FILE *IN,*OUT;
int c ;
int t;
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 (c=1;c<=5;c++)
{
fscanf (IN, "%d" ,&t);
o=fun(t);
fprintf (OUT, "%d\n" ,o);
}
fclose (IN);
fclose (OUT);
}
|