Write an object-based program to find the volume of 3 cuboid

Source: Internet
Author: User
Tags class definition
*  
* Copyright and version Statement of the procedure  
* Copyright (c) 2012, Yantai University Computer College student  
* all rightsreserved.  
* File name: Volume.cpp  
* Author: Sun Rui  
* Completion date: 2013  3  Month 25th  
* Version number: v1.0  
* Input Description: No  
* problem Description: Need to find 3 cuboid volume 
 * Program output: 3 volume numerical Value
*/   

#include <iostream>
using namespace std;
Class T
{
private:
	int length;
	int width;
	int height;
Public:
	void set ();
	void volume ();
};/ /Don't forget the semicolon
int main ()
{
	int i=0;
	Do
	{t
		t;
		T.set ();
		T.volume ();
		i++;
	} while (i<=2);//loop structure, control three times input return
	0;
}
class definition function
void T::set ()
{
	cout<< "long:";
	cin>>length;
	cout<< "Wide:";
	cin>>width;
	cout<< "High";
	cin>>height;
}
void T::volume ()
{
	cout<< "the volume of the cuboid is:" << (length*height*width) <<endl;
}


The program runs as follows:





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.