file1.c
#include<stdio.h>
#include"file2.c"
int main()
{
float test_product (float x,float y);
float a,b,pro;
printf("please enter a and b:");
scanf("%f,%f",&a,&b);
pro=test_product (a,b);
printf("%f and %f is the product of the %f\n",a,b,pro);
return 0;
}
file2.c
extern float test_product (float x,float y)
{
float product;
product=x*y;
return product;
}
你看看这样行不行,
#include<stdio.h>
#include"file2.c"
int main()
{
float test_product (float x,float y);
float a,b,pro;
printf("please enter a and b:");
scanf("%f,%f",&a,&b);
pro=test_product (a,b);
printf("%f and %f is the product of the %f\n",a,b,pro);
return 0;
}
file2.c
extern float test_product (float x,float y)
{
float product;
product=x*y;
return product;
}
你看看这样行不行,