-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInputOutput.cpp
More file actions
39 lines (31 loc) · 871 Bytes
/
InputOutput.cpp
File metadata and controls
39 lines (31 loc) · 871 Bytes
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
#include <iostream>
#include <cmath>
int main(){
double lotLength;
double lotWidth;
double lotArea;
double houseLength;
double houseWidth;
double houseArea;
double lawnArea;
double mowRate;
double mowTime;
int h, m, s;
std::cout << "Endter the length and width of the lot, in feet: ";
std::cin >> lotLength >> lotWidth;
lotArea = lotLength * lotWidth;
std::cout << "Endter the length and width of the house, in feet: ";
std::cin >> houseLength >> houseWidth;
houseArea = houseLength * houseWidth;
lawnArea = lotArea - houseArea;
printf("The lawn area is %f square feet.\n", lawnArea);
std::cout << "Enter the mowing rate, in square feet per second: ";
std::cin >> mowRate;
mowTime = lawnArea / mowRate;
s = (int) ceil(mowTime);
m = s/60;
s %= 60;
h = m/60;
m %= 60;
printf("The mowing time is %d hour %d minute %d second\n", h, m, s);
}