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
A Padovan string P(n) for a natural number n is defined as: P(0) = ‘X’ P(1) = ‘Y’ P(2) = ‘Z’ P(n) = P(n-2) + P(n-3), n>2 where + denotes string concatenation. For a string of t


I need whatsapp software in my website Project Description: i need whatsapp software in my website same this whatsapp if anyone can make to me this in my website Skills


string will contain only lower case alphabet& the ascii value starts from 1-26,(ie,a=1&z=26).it perform the operation like the following costs:add=2units,replace=1unit,delete=3unit

C Program to FIND VOWELS AND REMOVE VOWELS void main() {           char s[100],s1[100];           int i,j,k=0;           clrscr();           printf("ENTER ANY S

Memory Management Operator In C malloc( ), calloc( ), realloc( ), and free( ) are used to mange dynamic memory.  In addition to these function C++ have derived two unary ope

Ask4. Write a query to display the columns listed below. The query should list each customer in which the video rental is overdue. The Days_Overdue column should calculate the numb

Question : (a) What is a structure? Provide a simple example of your own to illustrate this feature. (b) How does a structure differ from an array? (c) Describe a structu

Project Description: I will need a tutor that would help me out in Data Structure and learning Algorithm more at the mathematical/algorithmic level. The book is written by "by T