其他分享
首页 > 其他分享> > 实验8-1-2 计算两数的和与差 (10 分)

实验8-1-2 计算两数的和与差 (10 分)

作者:互联网

#include <stdio.h>

void sum_diff(float op1, float op2, float *psum, float *pdiff);

int main()
{
    float a, b, sum, diff;

    scanf("%f %f", &a, &b);
    sum_diff(a, b, &sum, &diff);
    printf("The sum is %.2f\nThe diff is %.2f\n", sum, diff);

    system("pause");
    return 0;
}

/* 你的代码将被嵌在这里 */
void sum_diff(float op1, float op2, float *psum, float *pdiff) {
    *psum = op1 + op2;
    *pdiff = op1 - op2;
}

 

标签:10,op1,op2,pdiff,sum,float,实验,diff,两数
来源: https://www.cnblogs.com/Robert-De-Niro/p/15967424.html