Thread: complex calculator

  1. #16
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    United States
    >> did u mean this
    Honnestly, I don't know, I thought you were asking about input operations.

    Why can't you do something like
    int main()
        using std::cout;
        using std::cin; 
        double x,y;
        cout << "enter real part:\n"; 
        cin >> x;
        cout << "enter imaginary part:\n"; 
        cin >> y;
        complex number (x,y);
        cout << "enter real part:\n";
        cin >> x;
        cout << "enter imaginary part:\n";
        cin >> y;
        complex operand (x,y);    
        complex ans = number.multiply(operand); // or whatever math you do
        ans.disp ();
    Don't neglect the disp() function you wrote. I'm not sure what the problem is, but you are probably trying too hard to be clever.

  2. #17
    Registered User
    Join Date
    Sep 2010
    @ whiteflags
    actually i gone wrong about ur previous post my tongue languge is not english so sometimes i go in a wrong direction anyway
    as u r saying about the format of input i tried it and succesfully made the program for addition,subtraction, multiplication and division but when i showed it to my teacher he said "thats not what i wanted"
    so i consulted u for another way
    my teacher said dont take values from user on run time just initialize two objects with the given values of complex numbers as i have done in my program
    thats why i m having problems with the definition of multiplication division functions

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Complex Number Class
    By Sephiroth1109 in forum C++ Programming
    Replies: 15
    Last Post: 12-12-2007, 04:46 PM
  2. Why am I getting 'undelcared identifier' ???
    By Bill83 in forum C++ Programming
    Replies: 2
    Last Post: 02-15-2006, 01:00 PM
  3. arithmetic operator friend functions
    By linucksrox in forum C++ Programming
    Replies: 7
    Last Post: 02-06-2006, 11:39 PM
  4. Need help with calculator program
    By Kate in forum C# Programming
    Replies: 1
    Last Post: 01-16-2004, 10:48 AM
  5. Problem from texbook
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-26-2002, 04:55 AM