Category : C++ Source Code
Archive   : CPPTUT.ZIP
Filename : DEFAULT.CPP

 
Output of file : DEFAULT.CPP contained in archive : CPPTUT.ZIP
// Chapter 4 - Program 4
#include
#include

int get_volume(int length, int width = 2, int height = 3);

main()
{
int x = 10, y = 12, z = 15;

cout << "Some box data is " << get_volume(x, y, z) << "\n";
cout << "Some box data is " << get_volume(x, y) << "\n";
cout << "Some box data is " << get_volume(x) << "\n";

cout << "Some box data is ";
cout << get_volume(x, 7) << "\n";
cout << "Some box data is ";
cout << get_volume(5, 5, 5) << "\n";

}

int get_volume(int length, int width, int height)
{
printf("%4d %4d %4d ", length, width, height);
return length * width * height;
}




// Result of execution
//
// 10 12 15Some box data is 1800
// 10 12 3Some box data is 360
// 10 2 3Some box data is 60
// Some box data is 10 7 3 210
// Some box data is 5 5 5 125


  3 Responses to “Category : C++ Source Code
Archive   : CPPTUT.ZIP
Filename : DEFAULT.CPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/