Guest User

Untitled

a guest
Jan 3rd, 2011
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #pragma once
  2. #include <vector>
  3. #include <ostream>
  4.  
  5. //a*x^n
  6. struct Term{
  7.     double a;
  8.     unsigned n;
  9.  
  10.     Term(double a, int n);
  11. };
  12.  
  13. //a+bi
  14. struct Complex{
  15.     double a, b;
  16.     Complex(double a, double b);
  17.     Complex(double a);
  18.     Complex();
  19. };
  20.  
  21. Complex operator + (Complex A, Complex B);
  22. Complex operator - (Complex A, Complex B);
  23. Complex operator * (Complex A, Complex B);
  24. Complex operator / (Complex A, Complex B);
  25. bool operator == (Complex A, Complex B);
  26.  
  27. Complex pow(Complex c, int n);
  28.  
  29. std::ostream& operator << (std::ostream& out, Complex c);
  30.  
  31. //temporary construct for the actual solving.
  32. struct Polynomial{
  33.     std::vector<Term> p;
  34.  
  35.     Complex eval(Complex x);
  36.     int degree();
  37.     std::vector<Complex> solve();
  38. };
  39.  
  40. std::ostream& operator << (std::ostream& out, Polynomial p);
Advertisement
Add Comment
Please, Sign In to add comment