C Primer Plus6-8

来源:互联网 发布:snip mac 编辑:程序博客网 时间:2024/06/05 05:23
/*8.对练习 7 进行修改,让它使用一个函数来返回计算值。*/#include<stdio.h>#include<stdlib.h>double cal(float,float);int main() {      float a, b;     printf("Please input two number:");     while(scanf("%f %f", &a, &b))         {             printf("%lf\n",cal(a,b));             printf("Please input two number:");         }     system("pause");     return 0; }double cal(float a, float b) {     return (a - b) / (a * b); }

这里写图片描述

0 0
原创粉丝点击