#include<iostream.h>
#include<conio.h>
class db
{
private:
int feet,inch;
public:
void read()
{
cout<<"\n Enter Feet: ";
cin>>feet;
cout<<"\n Enter Inch: ";
cin>>inch;
}
void show()
{
cout<<"\n Feet: "<<feet<<"\n Inch: "<<inch<<endl;
}
int rf()
{
return feet;
}
int ri()
{
return inch;
}
};
class dm
{
private:
int meter,cm;
public:
void read()
{
cout<<"\n Enter Meter: ";
cin>>meter;
cout<<"\n Enter Centimeter: ";
cin>>cm;
}
void show()
{
cout<<"\n Meter: "<<meter;
cout<<"\n Centimeter: "<<cm;
}
void add(db d)
{
float mc=(d.rf()+(d.ri()/12))/3.2;
int mtr=mc;
int centimeter=((mc-mtr)*100);
meter+=mtr;
cm+=centimeter;
}
};
void main()
{
clrscr();
dm d1;
db d;
d1.read();
d.read();
d1.add(d);
d1.show();
getch();
}
#include<conio.h>
class db
{
private:
int feet,inch;
public:
void read()
{
cout<<"\n Enter Feet: ";
cin>>feet;
cout<<"\n Enter Inch: ";
cin>>inch;
}
void show()
{
cout<<"\n Feet: "<<feet<<"\n Inch: "<<inch<<endl;
}
int rf()
{
return feet;
}
int ri()
{
return inch;
}
};
class dm
{
private:
int meter,cm;
public:
void read()
{
cout<<"\n Enter Meter: ";
cin>>meter;
cout<<"\n Enter Centimeter: ";
cin>>cm;
}
void show()
{
cout<<"\n Meter: "<<meter;
cout<<"\n Centimeter: "<<cm;
}
void add(db d)
{
float mc=(d.rf()+(d.ri()/12))/3.2;
int mtr=mc;
int centimeter=((mc-mtr)*100);
meter+=mtr;
cm+=centimeter;
}
};
void main()
{
clrscr();
dm d1;
db d;
d1.read();
d.read();
d1.add(d);
d1.show();
getch();
}
No comments:
Post a Comment