Rectangular Cylinder 2

Source: Internet
Author: User

/* *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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.