• 例5-6


    #include<stdio.h>
    float result_real,result_imag;
    int main(void)
    {
        float imag1,imag2,real1,real2;
        void complex_prod(float real1,float imag1,float real2,float imag2);
        void complex_add(float real1,float imag1,float real2,float imag2);
    
        printf("Enter 1st complex number (real and imaginary):");
        scanf("%f%f",&real1,&imag1);
        printf("Enter 2nd complex number (real and imaginary):");
        scanf("%f%f",&real2,&imag2);
        complex_add(real1,imag1,real2,imag2);
        printf("addition of complex is%f+%fi
    ",result_real,result_imag);
        complex_prod(real1,imag1,real2,imag2);
        printf("product of complex is%f+%fi
    ",result_real,result_imag);
    
        return 0;
    }
    
    void complex_add(float real1,float imag1,float real2,float imag2)
    {
        result_real=real1+real2;
        result_imag=imag1+imag2;
    }
    void complex_prod(float real1,float imag1,float real2,float imag2)
    {
        result_real=real1*real2-imag1*imag2;
        result_imag=real1*imag2+real2*imag1;
    }

  • 相关阅读:
    css自适应
    css居中
    js生成签名
    javascript与Android、IOS交互
    js截取路径参数
    js date对象
    js判断设备、浏览器类型
    live555实践
    关于django
    mysql的基本知识
  • 原文地址:https://www.cnblogs.com/xym0914/p/3352502.html
Copyright © 2020-2023  润新知