| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1032 人关注过本帖
标题:求助啊,这个程序哪里有问题啊。总提示没有complex,film
只看楼主 加入收藏
王凯的编译
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2016-7-18
结帖率:0
收藏
已结贴  问题点数:10 回复次数:3 
求助啊,这个程序哪里有问题啊。总提示没有complex,film
/* Program 2.17 Working with complex numbers*/

#include <stdio.h>
#include <complex.h>


int main(void)
{
    double complex cx=1.0+3.0*I;
    double complex cy=1.0-4.0*I;

    printf("Working with complex numbers:");
    printf("\nStarting values: cx=%.2f%+.2fi cy=%.2f%+.2fi",
              creal(cx),cimag(cx),creal(cy),cimag(cy));

    double complex sum=cx+cy;
    printf("\n\nThe sum cx+cy=%.2f%+.2fi",
                creal(sum),cimag(sum));
    double complex difference=cx-cy;
    printf("\n\nThe difference cx-cy=%.2f%+.2fi ",
                creal(difference),cimag(difference));

    double complex product=cx*cy;
    printf("\n\nThe product cx*cy=%.2f%+.2fi",
        creal(product),cimag(product));

    double complex quotient=cx/cy;
    printf("\n\nThe quotient cx/cy=%.2f+%.2fi",
             creal(quoient),cimag(quotient));

    double complex conjugate=conj(cx);
    printf("\n\n The conjugate of cx =%.2f%+.2fi",
                 creal(conjugate),cimag(conjugate));
    return 0;
}
搜索更多相关主题的帖子: difference complex include numbers double 
2016-07-18 17:55
linlulu001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:20
帖 子:944
专家分:4047
注 册:2016-4-13
收藏
得分:4 
double complex ???
如果你想用complex来定义double类型,你应该用typedef声明或者用#define声明啊
2016-07-18 19:06
rjsp
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:528
帖 子:9007
专家分:53942
注 册:2011-1-18
收藏
得分:4 
除了quoient应该是quotient之外,没有语法错误。

你说“总提示没有complex,film”,你总得告诉别人你用的是什么编译器吧,它支持不支持当今的C语言?如果支持,是不是需要什么设置?
2016-07-18 20:18
zx315
Rank: 5Rank: 5
来 自:广东
等 级:职业侠客
威 望:2
帖 子:86
专家分:378
注 册:2016-7-13
收藏
得分:4 
图片附件: 游客没有浏览图片的权限,请 登录注册


没啥问题,除了楼上说的 quotient 这个变量拼错了之外~~~

Read The Fucking Source Code~
2016-07-18 23:59
快速回复:求助啊,这个程序哪里有问题啊。总提示没有complex,film
数据加载中...
 
   



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

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