EDN Admin
Well-known member
any help please. here is my code:
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
#include <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <iostream>
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
#include <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <string>
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
#include <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "rect.h"
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small using
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small namespace<span style="font-size:small <span style="font-size:small std;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int
ApiMain() {
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Mowing rate in square meters per second
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small MowRate
= 1.0f;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Pay rate desired
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small PayRate
= 6.0f;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Seconds in an hour
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small SecondsPerMinute
= 60;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Minutes in an hour
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small SecondsPerHour
=
<span style="font-size:small <span style="font-size:small
SecondsPerMinute * 60;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Length and width of display window
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small DisplayLength
= 20.0f;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small DisplayHeight
= 20.0f;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Scale factor for display. 100 meters equals
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // 1 centimeter
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small ScaleFactor
= 0.01f;
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please use meters for all inputn"<span style="font-size:small <span style="font-size:small <<
endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small LawnLength;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Length of the lawn in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the length of the lawn: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> LawnLength;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small LawnWidth;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Width of the lawn in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the width of the lawn: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> LawnWidth;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small HouseLength;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Length of the house in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the length of the house: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> HouseLength;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small HouseWidth;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Width of the house in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the width of the house: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> HouseWidth;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Echo the input so they can be verified
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout << endl;
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Yard size: "<span style="font-size:small <span style="font-size:small << LawnLength <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " by "
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<< LawnWidth <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " meters"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "House size: "<span style="font-size:small <span style="font-size:small << HouseLength <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " by "
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<< HouseWidth <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " meters"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Compute the mowable area
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small MowableArea = (LawnLength * LawnWidth)
<span style="font-size:small <span style="font-size:small
- (HouseLength * HouseWidth);
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Compute the time to cut and display it
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small MowTimeInSeconds = MowableArea / MowRate;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small Hours = MowTimeInSeconds / SecondsPerHour;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small Minutes = (MowTimeInSeconds
<span style="font-size:small <span style="font-size:small
- (Hours * SecondsPerHour)) / SecondsPerMinute;
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Time to cut: "<span style="font-size:small <span style="font-size:small << Hours <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " hour(s) "
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<< Minutes <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " minute(s)"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Compute the cost and display it
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small DollarCost = MowTimeInSeconds * PayRate
<span style="font-size:small <span style="font-size:small
/ SecondsPerHour;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small Dollars = DollarCost;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small Cents = (DollarCost - Dollars) * 100;
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Cost to cut: "<span style="font-size:small <span style="font-size:small << Dollars <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " dollar(s)"
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " and "<span style="font-size:small <span style="font-size:small << Cents <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " cent(s)"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Open the window and display the lawn
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
SimpleWindow Display(
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Lawn and House Plot"<span style="font-size:small <span style="font-size:small ,
<span style="font-size:small <span style="font-size:small
DisplayLength, DisplayHeight);
Display.Open();
RectangleShape Lawn(Display, DisplayLength / 2.0f,
DisplayHeight / 2.0f, Green,
LawnLength * ScaleFactor,
LawnWidth * ScaleFactor);
Lawn.Draw();
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Display the house
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
RectangleShape House(Display, DisplayLength / 2.0f,
DisplayHeight / 2.0f, Yellow,
HouseLength * ScaleFactor,
HouseWidth * ScaleFactor);
House.Draw();
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Type Ctrl-C to remove the display and exit"<span style="font-size:small <span style="font-size:small <<
endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small char<span style="font-size:small <span style="font-size:small AnyChar;
<span style="font-size:small <span style="font-size:small
cin >> AnyChar;
Display.Close();
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small return<span style="font-size:small <span style="font-size:small 0;
<span style="font-size:small <span style="font-size:small
}
View the full article
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
#include <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <iostream>
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
#include <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <string>
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
#include <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "rect.h"
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small using
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small namespace<span style="font-size:small <span style="font-size:small std;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int
ApiMain() {
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Mowing rate in square meters per second
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small MowRate
= 1.0f;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Pay rate desired
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small PayRate
= 6.0f;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Seconds in an hour
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small SecondsPerMinute
= 60;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Minutes in an hour
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small SecondsPerHour
=
<span style="font-size:small <span style="font-size:small
SecondsPerMinute * 60;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Length and width of display window
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small DisplayLength
= 20.0f;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small DisplayHeight
= 20.0f;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Scale factor for display. 100 meters equals
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // 1 centimeter
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small const<span style="font-size:small <span style="font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small ScaleFactor
= 0.01f;
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please use meters for all inputn"<span style="font-size:small <span style="font-size:small <<
endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small LawnLength;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Length of the lawn in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the length of the lawn: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> LawnLength;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small LawnWidth;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Width of the lawn in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the width of the lawn: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> LawnWidth;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small HouseLength;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Length of the house in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the length of the house: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> HouseLength;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small HouseWidth;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Width of the house in meters
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Please enter the width of the house: "<span style="font-size:small <span style="font-size:small ;
<span style="font-size:small <span style="font-size:small
cin >> HouseWidth;
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Echo the input so they can be verified
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
cout << endl;
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Yard size: "<span style="font-size:small <span style="font-size:small << LawnLength <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " by "
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<< LawnWidth <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " meters"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "House size: "<span style="font-size:small <span style="font-size:small << HouseLength <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " by "
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<< HouseWidth <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " meters"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Compute the mowable area
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small MowableArea = (LawnLength * LawnWidth)
<span style="font-size:small <span style="font-size:small
- (HouseLength * HouseWidth);
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Compute the time to cut and display it
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small MowTimeInSeconds = MowableArea / MowRate;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small Hours = MowTimeInSeconds / SecondsPerHour;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small long<span style="font-size:small <span style="font-size:small Minutes = (MowTimeInSeconds
<span style="font-size:small <span style="font-size:small
- (Hours * SecondsPerHour)) / SecondsPerMinute;
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Time to cut: "<span style="font-size:small <span style="font-size:small << Hours <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " hour(s) "
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<< Minutes <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " minute(s)"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Compute the cost and display it
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small float<span style="font-size:small <span style="font-size:small DollarCost = MowTimeInSeconds * PayRate
<span style="font-size:small <span style="font-size:small
/ SecondsPerHour;
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small Dollars = DollarCost;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small int<span style="font-size:small <span style="font-size:small Cents = (DollarCost - Dollars) * 100;
<span style="font-size:small <span style="font-size:small
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Cost to cut: "<span style="font-size:small <span style="font-size:small << Dollars <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " dollar(s)"
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
<<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " and "<span style="font-size:small <span style="font-size:small << Cents <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small " cent(s)"<span style="font-size:small <span style="font-size:small << endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Open the window and display the lawn
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
SimpleWindow Display(
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Lawn and House Plot"<span style="font-size:small <span style="font-size:small ,
<span style="font-size:small <span style="font-size:small
DisplayLength, DisplayHeight);
Display.Open();
RectangleShape Lawn(Display, DisplayLength / 2.0f,
DisplayHeight / 2.0f, Green,
LawnLength * ScaleFactor,
LawnWidth * ScaleFactor);
Lawn.Draw();
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small // Display the house
<span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <span style="color:#008000; font-size:small <br/>
<span style="font-size:small <span style="font-size:small
RectangleShape House(Display, DisplayLength / 2.0f,
DisplayHeight / 2.0f, Yellow,
HouseLength * ScaleFactor,
HouseWidth * ScaleFactor);
House.Draw();
cout <<
<span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small <span style="color:#a31515; font-size:small "Type Ctrl-C to remove the display and exit"<span style="font-size:small <span style="font-size:small <<
endl;
<span style="font-size:small <span style="font-size:small
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small char<span style="font-size:small <span style="font-size:small AnyChar;
<span style="font-size:small <span style="font-size:small
cin >> AnyChar;
Display.Close();
<span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small <span style="color:#0000ff; font-size:small return<span style="font-size:small <span style="font-size:small 0;
<span style="font-size:small <span style="font-size:small
}
View the full article