| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 578 人关注过本帖
标题:怎么继续做啊
取消只看楼主 加入收藏
老男孩123
Rank: 1
等 级:新手上路
帖 子:43
专家分:0
注 册:2013-9-6
结帖率:62.5%
收藏
已结贴  问题点数:20 回复次数:0 
怎么继续做啊

复数实部和虚部可作为结构体类型的两个成员,分别编写加减乘除四个函数完成两个复数的四则运算,并在main()中调用,要求结构体变量作为参数,返回值类型是结构体。





#include<stdio.h>
struct fushu
{
    int shi;
    int xu;
};
struct jia(struct fushu int x, int y)
{
    struct fushu s;
    s.shi=x.shi+y.shi;
    s.xu=x.xu+y.xu;
    return(s);
}

struct jian(struct fushu int x,int y)
{
   
    struct fushu s;
    s.shi=x.shi-y.shi;
    s.xu=x.xu-y.xu;
    return(s);
}
struct cheng(struct fushu int x,int y )
{
   
     struct fushu s;
    s.shi=x.shi*y.shi-x.xu*y.xu;
    s.xu=x.shi*y.xu+y.shi*x.xu;
    return(s);
}
struct chu(struct fushu int x,int y )
{
      struct fushu s;
      s.shi=(x.shi*y.shi+x.xu*y.xu)/(pow(y.shi,2)+pow(y.xu,2));
      s.xu=(x.xu*y.shi-x.shi*y.xu)/(pow(y.shi,2)+pow(y.xu,2));
      return(s);
}
void main()
{

    struct fushu s;
    scanf("%d %d",&s.shi,&s.xu);
    int a,b,c,d;
    a=jia(x,y);
    b=jian(x,y);
    c=cheng(x,y);
    d=chu(x,y);
}
搜索更多相关主题的帖子: include return 结构体 cheng 
2013-09-12 18:54
快速回复:怎么继续做啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021964 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved