commit 14777566c094bbd2f709829b0ea3636801a540ac parent 5889a8fd8c29614f16451d3f4734f17840f86b9f Author: Amit Dutta <mail@amit.is-a.dev> Date: Mon, 27 Jul 2026 09:08:52 +0530 trying with micro Diffstat:
| A | semester_2/eduincs/pgrm_013.cpp | | | 51 | +++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 51 insertions(+), 0 deletions(-)
diff --git a/semester_2/eduincs/pgrm_013.cpp b/semester_2/eduincs/pgrm_013.cpp @@ -0,0 +1,51 @@ +/* + * Author: Amit Dutta (amitdutta4255@gmail.com) + * Repo: https://github.com/notamitgamer/bsc + * License: MIT + */ +/* in-line and non-inline functions */ + +#include<iostream> +using namespace std; +class cuboid { +private: + float length, breadth, height; +public: + cuboid() {length = breadth = height = 0;} + + void getData(); + void display(); + + //inline + float volume() { + return length * breadth * height; + } + + //inline + float surfaceArea() { + return 2 * (length * breadth + breadth * height + height * length); + } +}; + +// non inline +void cuboid :: getData() { + cout << "Enter length, breadth and height: "; + cin >> length >> breadth >> height; +} + +// non inline +void cuboid :: display() { + cout << "\nCuboid Details" << endl; + cout << "length: " << length << endl; + cout << "breadth: " << breadth << endl; + cout << "Height: " << height << endl; + cout << "Volume: " << volume() << endl; + cout << "Surface Area: " << surfaceArea() << endl; +} + +int main() { + cuboid obj; + obj.getData(); + obj.display(); + return 0; +}