/* *copyright (c) 2016, College of Computer and Control engineering, Yantai University *all rights reserved * File name: 123.cpp * Author: Zong Tao * Completion Date: May 8, 2016 * version number: v1.0 * * Problem Description: Ask 3 The volume of the Long Fang (Bulk). Data members include length (length), Width (width), height (heigth), Volume * Input description: Three integers representing the length and width of the height. * Program output: Two numbers, representing the volume and surface area of the long Fang * * #include <iostream>using namespace Std;class bulk{public:void get_value (); void display ();p rivate:float lengh; float width; float height;}; void Bulk::get_value () {cout<< "Please input lengh, width,height:"; cin>>lengh; cin>>width; Cin>>height;} void Bulk::d isplay () {cout<< "The volume is:" <<lengh*width*height<<endl; cout<< "The surface area is:" <<2* (Lengh*width+lengh*height+width*height) <<endl;} int main () {Bulk b1,b2,b3; B1.get_value (); cout<< "for Bulk1:" <<endl; B1.display (); B2.get_value (); cout<< "for Bulk2:" <<endl; B2.display (); B3.get_value (); cout<< "for Bulk3:" <<endl; B3.display (); return 0;}
Operation Result:
Rectangular Cylinder 2