Pages

Tuesday, October 11, 2011

6.Operator Overloading

WAP USING OPERATOR OVERLOADING TO ENTER RECTANGULAR CO-ORDINATES AND CONVERT THEM INTO POLAR CO-ORDINATES & VICE-VERSA





#include<conio.h>
#include<iostream.h>
#include<math.h>
class rec;
class polar
{
float rad,ang;
public:
polar()   //without default constructor they is an error message
{         //couldnot find a match for polar::polar()
}

5.Operator Overloading

WAP USING OPERATOR OVERLOADING TO ENTER THE MEMORY IN BYTES AND CONVERT THEM INTO MB,KB & BYTES


#include<iostream.h>
#include<conio.h>
class memory
{
long int b,kb,mb;
public:
memory(long int d)
{
b=d%1024;
d=d/1024;
kb=d%1024;
d=d/1024;
mb=d%1024;
}

4.Operator Overloading

WAP USING CONSTRUCTOR OVERLOADING TO ENTER THE VALUES OF X & Y AND ADD AND SUB THEM

#include<conio.h>
#include<iostream.h>
class vector
{
float x,y;
public:
void getdata()
{
cout<<"\nEnter the value of x & y::";
cin>>x>>y;
}