All pastes #396244 Raw Edit

Kiryn

public cpp v1 · immutable
·published 2007-03-15 16:54 UTC
rendered paste body
#include "stdafx.h"class Box{public:	double Length;	double Width;	double Height;	double Volume()	{		return(Length * Width * Height);	}};int _tmain(int argc, _TCHAR* argv[]){	Box box1;	Box box2;	double boxVolume = 0.0;	box1.Height = 10.0;	box1.Length = 78.0;	box1.Width = 24.0;	box2.Height = box1.Height - 10;	box2.Length = box1.Length / 2.0;	box2.Width = 0.25 * box1.Length;	boxVolume = box1.Volume();	std::wcout << std::endl		       << "Volume of box1 = " << boxVolume;	std::wcout << std::endl			   << "Volume of box2 = "			   << box2.Volume();	std::wcout << std::endl			   << "A Box object occupies "			   << sizeof(box1) << " bytes.";	std::wcout << std::endl;	return 0;}