Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<time.h>
- #include<string>
- #include"complex.h"
- using namespace std;
- int main(){
- clock_t start_t = clock();
- complex* a = new complex(5.0, 6.0);
- complex* b = new complex(-3.0, 4.0);
- complex* c = *a + *b;
- complex* d = *a - *b;
- complex* e = *a * *b;
- complex* e2 = *b * *a;
- complex* f = *a / *b;
- complex* g = *f * *b;
- complex* h = a->conjugate();
- complex* j = a->tangent();
- complex* k = a->sinus();
- complex* l = a->cosinus();
- cout << "a = " << *a << endl;
- cout << "b = " << *b << endl;
- cout << "Re(a) = " << (*a).re() << endl;
- cout << "Im(a) = " << (*a).im() << endl;
- cout << "b + a = " << *c << endl;
- cout << "a - b = " << *d << endl;
- cout << "a * b = " << *e << endl;
- cout << "b * a = " << *e2 << endl;
- cout << "a / b = " << *f << endl;
- cout << "(a / b) * b = " << *g << endl;
- cout << "conj(a) = " << *h << endl;
- cout << "|a| = " << a->abs() << endl;
- cout << "a = " << *a << endl;
- cout << "tan(a) = " << *j << endl;
- cout << "sin(a) = " << *k << endl;
- cout << "cos(a) = " << *l << endl;
- delete a, b, c, d, e, e2, f, g, h, j;
- cout << "execution in " << clock() - start_t << " ms \n";
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment