标签:div void number turn bsp psu int return std
#include<Stdio.h> void sum_diff(float op1,float op2,float *psum,float *pdiff) { *psum=op1+op2; *pdiff=op1-op2; } int main() { float op1,op2,*psum,*pdiff,sum,diff; printf("Input 2 number:"); scanf("%f%f",&op1,&op2); sum_diff(op1,op2,&sum,&diff); printf("sum=%.2f diff=%.2f",sum,diff); return 0; }
#include<stdio.h> void findmax( int *px,int *py,int *pmax) { if(*px>*py) *pmax=*px; if(*py>*px) *pmax=*py; } int main() { int *px,*py,a,b,max; printf("Input 2 number:"); scanf("%d%d",&a,&b); px=&a; py=&b; findmax(px,py,&max); printf("max=%d",max); return 0; }
#include<Stdio.h> void splitfloat (float x, int *intpart,float *fracpart) { int y; float z; y=x/1; z=x-y; *intpart=y; *fracpart=z; } int main() { float xs,x,z,*intpart,*fracpart; int y,zs; printf("Input x:"); scanf("%f",&x); splitfloat(x,&zs,&xs); printf("intpart=%d fracpart=%.2f",zs,xs); return 0; }
标签:div void number turn bsp psu int return std
原文地址:http://www.cnblogs.com/ly6251/p/6216610.html