首页 > 代码库 > 第十次作业
第十次作业
1.拆分整数与小数部分
#include <stdio.h> void sum_diff(float op1,float op2,float *psum , float* pdiff) { *psum = op1+op2; *pdiff = op1-op2; } int main(void) { float f1=11.1, f2=1.5, sum, diff; sum_diff(f1, f2, &sum, &diff); printf("sum=%g, diff=%g\n", sum, diff); }
2.找最大值
#include<stdio.h> void findmax( int *px, int *py, int *pmax ) { *pmax = *px; if(*py > *pmax) *pmax = *py; } int main(void) { int max,x,y; scanf("%d%d",&x,&y); findmax(&x,&y,&max); printf("max:%d\n",max); }
3.计算两个数的和与差
#include <stdio.h> void sum_diff(float op1,float op2,float *psum , float* pdiff) { *psum = op1+op2; *pdiff = op1-op2; } int main(void) { float f1=11.1, f2=1.5, sum, diff; sum_diff(f1, f2, &sum, &diff); printf("sum=%g, diff=%g\n", sum, diff); }
第十次作业
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。