Subscribe Us

Responsive Advertisement

Advertisement

E.balagurusamy 5.5 exercise solution

 

E.balagurusamy 5.5 exercise solution




#include<bits/stdc++.h>

using namespace std;

class DM;

class DB

{

    int f;

public :

      void getdata(float x)

      {

          f=x;

      }

      friend void sum(DM,DB);


};

class DM

{

    int m;

public :

      void getdata(float x)

      {

          m=x;

      }

      friend void sum(DM,DB);

};

void sum(DM me,DB fi)

{

    float meter=me.m+(fi.f)*0.3048;

    float feet=meter/0.3048;

    cout<<"1.In meter : \n2.In feet\n";

    int choose;

    cin>>choose;

    if(choose==1)

    {

        cout<<meter<<" "<<meter*100<<endl;

    }

    else cout<<feet<<" "<<feet*12<<endl;

}

int main()

{

    DM dm;

    DB df;

    dm.getdata(100);

    df.getdata(50);

    sum(dm,df);



    return 0;

}


Post a Comment

0 Comments