第41题
功能:根据整型形参m,计算如下公式的值:y=sin(m)*10。
例如:若m=9,则应输出:4.121185。
#include<stdio.h>
#include<math.h>
double fun(int m)
{
double y;
_____1_____
_____2_____
_____3_____
}
void main()
{
int n;
void TestFunc();
printf("Enter n:");
scanf("%d",&n);
printf("\nThe result is %1f\n",fun(n));
TestFunc();
}
void TestFunc()
{
FILE *IN,*OUT;
int s,i;
int t;
double 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(i=0;i<5;i++)
{
fscanf(IN,"%d",&t);
o=fun(t);
fprintf(OUT,"%lf\n",o);
}
fclose(IN);
fclose(OUT);
}