标签:部分 div img diff blog amp bsp 个数 code
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); }
标签:部分 div img diff blog amp bsp 个数 code
原文地址:http://www.cnblogs.com/moyansameal/p/6106419.html