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
|
#include <iostream>
#include "FeetInches.cpp"
using namespace std;
void doOutput(string name, FeetInches h)
{
cout << name << " is " << h.getFeetComponent() << "'" << h.getInchesComponent() << "\"" << endl;
}
int main()
{
cout << "-- Testing constructors --" << endl;
FeetInches h1(54);
FeetInches h2(7, 9);
doOutput("h1", h1);
doOutput("h2", h2);
cout << "-- Testing setLength --" << endl;
h1.setLength(2, 9);
h2.setLength(37);
doOutput("h1", h1);
doOutput("h2", h2);
h1.setLength(6, 4);
h2.setLength(76);
doOutput("h1", h1);
doOutput("h2", h2);
h1.setLength(6, 3);
h2.setLength(76);
doOutput("h1", h1);
doOutput("h2", h2);
h1.setLength(6, 5);
h2.setLength(76);
doOutput("h1", h1);
doOutput("h2", h2);
}
|