代码;
main.c
#include <stdio.h>
#include "add.h"
#include "sub.h"
int main(void)
{
int a=10,b=12;
float x=1.23456,y=9.87654321;
printf("int a+b IS :%d\n",add_int(a,b));
printf("int a-b IS :%d\n",sub_int(a,b));
printf("float x+y IS :%f\n",add_float(x,y));
printf("float x-y IS :%f\n",sub_float(x,y));
return 0;
}
add_int.c
int add_int(int a,int b)
{
return a+b;
}
add_float.c
float add_float(float a,float b)
{
return a+b;
}
sub_int.c
int sub_int(int a,int b)
{
return a-b;
}
sub_float.c
float sub_float(float a,float b)
{
return a-b;
}
编译运行