zoukankan      html  css  js  c++  java
  • 例5-6

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

  • 相关阅读:
    MARTIN FOWLER谈敏捷开发
    精益创业
    DEVOPS基础
    测试驱动开发
    持续集成(CONTINUOUS INTEGRATION)
    极限编程
    回归测试
    敏捷开发十二原则
    敏捷开发宣言
    敏捷开发简史
  • 原文地址:https://www.cnblogs.com/blgl/p/3355267.html
Copyright © 2011-2022 走看看