You need to ask for three cuboid volume, write an object-based program.

Source: Internet
Author: User
121218 Eighth Chapter Exercise 6.cpp: Defines the entry point for a console application.         
* * Copyright (c) 2012, Computer College of Yantai University * All rights reserved. * Author: Liu Tongbin * Date of Completion: December 18, 2012 * Version number: v1.0 * Input Description: * Problem Description: Need to find three cuboid volume, please write an object-based program 。        
Data including Length,width,height, requires the use of member functions to achieve the following functions 1, by the keyboard input 3 cuboid long, wide, high 2, calculate the volume of the cuboid 3, Output 3 cuboid volume * Program output: * Problem analysis: slightly
* Algorithm design: Slightly * * * #include "stdafx.h" #include <iostream> using namespace std;
	Declares class Area {public:void Set_area ();
void Show_area ();
	Private:double length;
	Double width;
	Double height;
Double area1;
};
	Enter the function void Area::set_area () {cout<< "Enter the cuboid width and height separately:" <<endl;
cin>>length>>width>>height;

	}//Calculation function void Area::show_area () {area1=length*width*height;
cout<< "cuboid area is:" <<area1<<endl;

	}//main function int main () {area area2,area3,area4;//definition object Area3.set_area ();//Function call Area3.show_area ();

	Area3.set_area ();//Function call Area3.show_area (); Area3.set_area ();//function tuningWith Area3.show_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.