1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cmath>
using namespace std;
//Function Prototypes
int Read();
int Area(int,int,int);
void Write(int,int,int,int,ofstream);
void PrintHeader();
ofstream out("Area.out");
ifstream inf("Area.in");
void PrintHeader(ofstream& out)
{
out << "\t\t\tBOX PROGRAM\n"
<< " Dimension\tArea";
}
int Read(ifstream& inf)
{
int z;
inf >> z;
return z;
}
int Area(int w, int h, int l)
{
return w*h*l;
}
void Write(int a, int b, int c, int d, ofstream& out)
{
out << " " << a << "x" << b << "x" << c
<< "\t" << d << endl;
}
int main()
{
int x,y,z,j;
PrintHeader(out);
Read(inf);
Read(inf);
Read(inf);
Area(x,y,z);
Write(x,y,z,j,out);
inf.close();
out.close();
return 0;
}
| |