Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "complex.hpp"
- complex add(const complex& a, const complex& b) {
- return complex(a.rzeczywista + b.rzeczywista, a.urojona + b.urojona);
- }
- complex substract(const complex& a, const complex& b) {
- return complex(a.rzeczywista - b.rzeczywista, a.urojona - b.urojona);
- }
- complex multiply(const complex& a, const complex& b) {
- return complex(a.rzeczywista * b.rzeczywista - a.urojona * b.urojona, a.urojona* b.rzeczywista + a.rzeczywista* b.urojona);
- }
- bool equals(const complex& a, const complex& b) {
- if (a.rzeczywista == b.rzeczywista && a.urojona == b.urojona)return true;
- else return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement