/* 对练习7进行修改,让它使用一个函数来返回计算值。 */ #include <stdio.h> double TheEffect(double x,double y); int main (void) { double x,y,effect; printf("Please input two double./n"); while(2 == scanf("%lf%lf",&x,&y)) { effect = TheEffect(x,y); printf("The Effect is %lf/n",effect); } system("pause"); return 0; } double TheEffect(double x,double y) { return (x > y)?(x - y):(y - x) / ( x * y) ; }