码迷,mamicode.com
首页 > 其他好文 > 详细

作业10

时间:2016-12-24 07:46:04      阅读:235      评论:0      收藏:0      [点我收藏+]

标签: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;
}

 

作业10

标签:div   void   number   turn   bsp   psu   int   return   std   

原文地址:http://www.cnblogs.com/ly6251/p/6216610.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!