Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class complexNum
- {
- private:
- double w, i;
- public:
- complexNum ();
- complexNum (double, double);
- void add (complexNum o)
- {
- w += o.getWholePart();
- i += o.getImagiPart();
- }
- void subtract (complexNum o)
- {
- w -= o.getWholePart();
- i -= o.getImagiPart();
- }
- void multiply (complexNum o)
- {
- w = w*o.getWholePart() - i*o.getImagiPart();
- i = w*i + i*o.getWholePart();
- }
- void print(complexNum o)
- {
- std::cout << "blah";
- }
- double getWholePart ()
- {
- return w;
- }
- double getImagiPart ()
- {
- return i;
- }
- void print()
- {
- std :: cout << "(" << w << " + " << i<<"i)";
- }
- };
- complexNum::complexNum ()
- {
- w = 16;
- i = 12;
- }
- complexNum::complexNum (double wPart, double iPart)
- {
- w = wPart;
- i = iPart;
- }
- int main()
- {
- double x1, y1, x2, y2;
- std::cout << "Enter an x1 and y1 value in the form x1, y1";
- std::cin >> x1 >> y1;
- std::cout << "Enter an x2 and y2 value in the form x2, y2";
- std::cin >> x2 >> y2;
- complexNum.add;
- a.print();
- complexNum.subtract;
- complexNum.multiply;
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement