source file name: OOP5.CPP 


#include <iostream.h>

// create a class

class Room

 {

    int len;

    int bd;

    int ht;

public:

void setdata(int a, int b, int c)

{

len=a;

bd=b;

ht=c;

}

    long area() {

return len * bd;

    }


    long volume() {

return len * bd * ht;

    }

};


int main()

 {


    // create object of Room class

    Room room1,room2;


    // assign values by  function members

      room1.setdata(100,25,30);

      room2.setdata(300,50,40);


    // calculate and display the area and volume of the room 1

    cout << "Area of Room 1 =  " << room1.area() << endl;

    cout << "Volume of Room 1=  " << room1.volume() << endl;

    // calculate and display the area and volume of the room 1

    cout << "Area of Room 2 =  " << room2.area() << endl;

    cout << "Volume of Room 2=  " << room2.volume() << endl;


    return 0;

}

output:

Area of Room 1 =  2500
Volume of Room 1=  75000
Area of Room 2 =  15000
Volume of Room 2=  600000