Example #1
0
/*
 * The LandTract main thread
 */
int main(int argc, char** argv) {

    LandTract* first;
    LandTract* second;

    cout << "The first tract of land info:\n";
    first = new LandTract();

    cout << "The second tract of land info:\n";
    second = new LandTract();

    FeetInches fArea = first->getTractArea();
    FeetInches sArea = second->getTractArea();

    cout << "The area of the first tract of land is: " << fArea.getFeet() << "(feet^2)  "
            << fArea.getInches() << "(inch^2)\n";
    
    cout << "The area of the second tract of land is: " << sArea.getFeet() << "(feet^2)  "
            << sArea.getInches() << "(inch^2)\n";
    
    if (fArea == sArea){
        cout << "The tracts are of equal size.";
    }
    
    if (fArea != sArea){
        cout << "The tracts are of different size.";
    }

    return 0;
}
Example #2
0
int main(){

	//create two instances of FeetInches
	FeetInches first = FeetInches();
	FeetInches second = FeetInches();

	//set feet and inches values for the first FeetInches class
	first.setFeet(3);
	first.setInches(2);

	//set feet and inches for the second FeetInches class
	second.setFeet(4);
	second.setInches(0);

	// test the overloaded <= operator
	if (first <= second)
	{
		cout << "first is less than or equal to the second" << endl;
	}

	// test the overloaded >= operator
	if (first >= second)
	{
		cout << "first is greater than or equal to second" << endl;
	}

	// test the overloaded != operator
	if (first != second)
	{
		cout << "the first is not equal to the second" << endl;
	}

	// create a third instance of class FeetInches
	// to be identical to the first instance
	FeetInches third = first;

	// display feet and inches of third instance to show it is
	// identical to the first instance
	cout << third.getFeet() << "feet " << third.getInches() << "inches" << endl;

	return 0;
}
Example #3
0
void showFeetInches(const FeetInches &fi)
{
	cout << "Feet: " << fi.getFeet() << endl;
	cout << "Inches: " << fi.getInches() << endl;
	cout << endl;
}