# OOP/CPP Distance class to Convert feet & inches into meter & centimeter and vice versa

#include <iostream>
using namespace std;
#include<stdlib.h>
//1 inch= 2.54cm, 1 feet=30.48cm =12*2.54cm,1 cm=0.40 inches.
class DB;    // forward declaration
class DM
{
int met,cm;
public:
void initialize(){met=0;cm=0;}
void set_distance(int i,int j){met=i;cm=j;}
void get_distance()
{
cout<<“\n\n\n\n\tIN METER CENTEMETER……\n\n\n”;
cout<<“\n\tMETER = “<<met<<endl;
cout<<“\n\tCENTIMETER = “<<cm;
}
};
class DB
{
int feet,inch;
public:
void initialize(){feet=0;inch=0;}
void set_distance(int i,int j){feet=i;inch=j;}
void get_distance()
{
cout<<“\n\n\n\n\tIN FEET & INCH….\n\n\n”;
cout<<“\n\tFEET = “<<feet<<endl;
cout<<“\n\tINCH = “<<inch;
}
};
{
float met1,totinch;
int cem1,totcem;
totinch=(dbob.feet*12)+dbob.inch;
totcem=totinch*2.54;
met1=(dmob.cm+totcem)/100+dmob.met;
cem1=(dmob.cm+totcem)%100;
dmob.met=met1;
dmob.cm=cem1;
return dmob;
}
{
float feet1,totcem;
int inch1,totinch;
totcem=(dmob.met*100)+dmob.cm;
totinch=totcem * 0.40;
feet1=(dbob.inch+totinch)/12+dbob.feet;
inch1=(dbob.inch+totinch)%12;
dbob.feet=feet1;
dbob.inch=inch1;
return dbob;
}
int main()
{
DM dm_ob;
DB db_ob;
float meter,cem;
float ft,inc;
char chk;
while(1)
{
cout<<“\tConvert feet & inches into meter & centimeter and vice versa\n”;
cout<<“\t=============================================\n\n\n”;
dm_ob.initialize();
db_ob.initialize();
cout<<“\n\tEnter distance in METER & CENTEMETER …. \n”;
cout<<“\n\tMeter =  “;
cin>>meter;
cout<<“\n\tCentermeter =   “;
cin>>cem;
cout<<“\n\n\n\n\tEnter distance in feet & inch ….\n”;
cout<<“\n\tFeet = “;
cin>>ft;
cout<<“\n\tInches = “;
cin>>inc;
dm_ob.set_distance(meter,cem);
db_ob.set_distance(ft,inc);
cout<<“\n\tPress ‘m’ to see result in METER & CENTEMETER \n\t”;
cout<<“Otherwise press ‘f’ to see result in FEET & INCH “;
cin>>chk;
if(chk==’m’)
{