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
good night i have an assignment that i really need help with. i have to create a struct file with tag name book to have members int book_id char isbn[255]

Control Flow The control flow statements are used when it is needed that the flow of the program is to be changed after taking some decision. This control flow statement theref

GetChar - get a character from the keyboard, echo to the display and return it in reg al. - Note: if a linefeed (LF) is received (Enter key), a carriage return (CR) will als

#include #include #include #include #include class Employee { private: char *Name; //Set them as pointers... int IdNumber; char *Department; char *Position; public: voi

What is the difference between JavaScript and PHP? The difference lies with the execution of languages. PHP is server side scripting language, which means that it cannot intera

What is the real function of class - to export data? No, Real purpose of a class isn't to export data. Instead, it's to provide services. Class provides a way to abstract behav

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Spider webs have two types of silk, sticky silk and strength silk, spiders do not move on the sticky silken threads only on the strength threads. Assume one type of spider creates