Lab report for week 3 (IV)

Source: Internet
Author: User

# Include <iostream>
Using namespace STD;
Class box
{

Public:

Void get_value ();
Void display ();
Float volume ();
Float area ();

PRIVATE:

Float length;
Float width;
Float height;

};
Void box: get_value ()
{
Cout <"Please input length, width, height :";

Cin> length;

Cin> width;
Cin> height;
}
Float box: volume ()
{
Return (length * width * Height );
}
Float box: Area ()
{
Cout <2 * (width * height + length * width + length * Height) <Endl;
Return 0;
}

Void box: Display ()
{
Cout <volume () <Endl;
}
Int main ()
{
Box box1, box2, box3;
Box1.get _ value ();
Cout <"volmue of box1 is ";
Box1.display ();
Cout <"area of box1 is ";
Box1.area ();
Box2.get _ value ();
Cout <"volme of box2 is ";
Box2.display ();
Cout <"area of box2 is ";
Box2.area ();
Box3.get _ value ();
Cout <"volme of box3 is ";
Box3.display ();
Cout <"area of box3 is ";
Box3.area ();
Return 0;
}

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.