Convert coordinate - c++ program, C/C++ Programming

Convert coordinate:

class rect{

                private :

                float  x,y;

 

                public :

                void  input()

                {

                cout <<"enter rect coords\n";

                cin >> x>> y>>"\n";

                }

                void output()

                {

                                cout << x<<"\n" << y;

                }

                rect ()//dummy consructor

                {

                }

                rect (float a,float b)//constructor

                {

                x=a;

                y=b;

                }

                }; //end of class

 

                class polar {

                private :

                float r,q;

 

                public :

                void input()

                {

                cout <<"enter polar coords\n";

                cin>>r>>q;

 

                }

                void output()

                {

                cout << r<

                }

                operator rect();

                };//end of class

 

       polar :: operator rect()

                                {

                                float a=r*cos(22*q/(7*180));

                                float b=r*sin(22*q/(7*180));

                                return rect(a,b);//calling constructor inbuild that it will

                                                                 //return rect type

                                }

    void main()

    {

 

    rect a;

    polar p;

    clrscr();

    p.input();

    a=p;

    a.output();

    getch();

    }

Posted Date: 10/18/2012 6:41:09 AM | Location : United States







Related Discussions:- Convert coordinate - c++ program, Assignment Help, Ask Question on Convert coordinate - c++ program, Get Answer, Expert's Help, Convert coordinate - c++ program Discussions

Write discussion on Convert coordinate - c++ program
Your posts are moderated
Related Questions

Hi I''m trying to connect to CISCO router using termios. So I decided to have two threads one for reading data and the other one for writing data. The problem is that I have to add

Selection Sort using this a nested for loop to iterate through and compare the array elements. If the value of an element with lower index is greater than the value of an element w

In POS system, cashier computer connect to printer using serial rs232 usb or cable. We need to capture data from that connection, and parsing the data to get total amount for every

i need a program that find the number of negative integers in a list.

plaese tell the full program for the above given topic with the input and output

Objective:  Construct a C program that controls the LCD display, and is capable of displaying strings.  Add functions to the C program that allows more control over the display.

Stage One Define the specification of the program            Add two nxm size matrices   Stage Two Divide the program up into separate modules           Input Matrix         Ad

Q:  Tells the operators one can override; which operators should he override? A: Bottom line: don't puzzle your users. Remember the reason of operator overloading: to decreas

Write a program that predicts users age: Write a program that predicts users' age (0-128 years old) with at most 7 questions. The game starts with asking the user whether he/s