Advertisement
Guest User

Untitled

a guest
Dec 9th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include "complex.hpp"
  2.  
  3. complex add(const complex& a, const complex& b) {
  4.  
  5. return complex(a.rzeczywista + b.rzeczywista, a.urojona + b.urojona);
  6.  
  7. }
  8.  
  9. complex substract(const complex& a, const complex& b) {
  10.  
  11. return complex(a.rzeczywista - b.rzeczywista, a.urojona - b.urojona);
  12.  
  13. }
  14.  
  15. complex multiply(const complex& a, const complex& b) {
  16.  
  17. return complex(a.rzeczywista * b.rzeczywista - a.urojona * b.urojona, a.urojona* b.rzeczywista + a.rzeczywista* b.urojona);
  18.  
  19. }
  20.  
  21. bool equals(const complex& a, const complex& b) {
  22.  
  23. if (a.rzeczywista == b.rzeczywista && a.urojona == b.urojona)return true;
  24.  
  25. else return false;
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement