main.c文件
#include <stdio.h>
#include "algorithm.h" //包含李四的头文件
int main(){
double a,b;
printf("请输入两个数:\n");
scanf("%lf%lf",&a,&b);
double plus = Plus(a, b);
double minus = Minus(a, b);
double multiply = Multiply(a, b);
double divide = Divide(a, b);
printf("%lf和%lf的\n和:%.5lf\n差:%.5lf\n积:%.5lf\n商:%.5lf\n\n",a,b,plus,minus,multiply,divide);
return 0;
}
// algorithm.h文件
#ifndef text_algorithm_h
#define text_algorithm_h
double Plus(double x,double y){
return x+y;
}
double Minus(double x,double y){
return x-y;
}
double Multiply(double x,double y){
return x*y;
}
double Divide(double x,double y){
return x/y;
}
#endif
|
|