complex calculator

This is a discussion on complex calculator within the C++ Programming forums, part of the General Programming Boards category; >> did u mean this Honnestly, I don't know, I thought you were asking about input operations. Why can't you ...

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

    Why can't you do something like
    Code:
    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
    Posts
    41
    @ 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

Page 2 of 2 FirstFirst 12
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, 03:46 PM
  2. Why am I getting 'undelcared identifier' ???
    By Bill83 in forum C++ Programming
    Replies: 2
    Last Post: 02-15-2006, 12:00 PM
  3. arithmetic operator friend functions
    By linucksrox in forum C++ Programming
    Replies: 7
    Last Post: 02-06-2006, 10:39 PM
  4. Need help with calculator program
    By Kate in forum C# Programming
    Replies: 1
    Last Post: 01-16-2004, 09:48 AM
  5. Problem from texbook
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-26-2002, 04:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21