summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Bouchillon <[email protected]>2022-10-16 17:11:00 -0700
committerTrevor Bouchillon <[email protected]>2022-10-16 17:11:00 -0700
commitcd8fd92d904770ccc0468589c5483a9ce6775d63 (patch)
treede30d7bbd93e10f4342e7900b01b5692caa712ab
parentadded more clarifications (diff)
downloadcst116-lab1-daboochillin-cd8fd92d904770ccc0468589c5483a9ce6775d63.tar.xz
cst116-lab1-daboochillin-cd8fd92d904770ccc0468589c5483a9ce6775d63.zip
p2 1 complete
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp40
1 files changed, 31 insertions, 9 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index 47ac6bd..ba4e34c 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -14,17 +14,39 @@ using std::endl;
int main()
{
- float kitewidth;
- float kitelength;
- float kiteaream;
- float kiteareacm;
- float kiteaspectratio;
+ float kitewidth = 0;
+ float kitelength = 0;
+ float kiteaream = 0;
+ float kiteareacm = 0;
+ float kiteaspectratio = 0;
+
+ while (kitewidth < 1 || kitewidth >400) {
+ cout << "Please enter width of kite (horizontal diagonal) in meters." << endl;
+ cin >> kitewidth;
+ if (kitewidth < 1) {
+ cout << "Please enter a value between 1 and 400" << endl;
+ }
+ else if (kitewidth > 400){
+ cout << "Please enter a value between 1 and 400" << endl;
+ }
+ }
+ while (kitelength < 1 || kitelength > 400) {
+ cout << "Please enter length of kite (vertical diagonal) in meters." << endl;
+ cin >> kitelength;
+ if (kitelength < 1) {
+ cout << "Please enter a value between 1 and 400" << endl;
+ }
+ else if (kitelength > 400) {
+ cout << "Please enter a value between 1 and 400" << endl;
+ }
+ }
+
+
+
+
+
- cout << "Please enter width of kite (horizontal diagonal) in meters." << endl;
- cin >> kitewidth;
- cout << "Please enter length of kite (vertical diagonal) in meters." << endl;
- cin >> kitelength;
cout << "Your kites length is: " << kitelength << " meters, and your kites width is: " << kitewidth << " meters." << endl;
kiteaream = (kitewidth * kitelength) / 2;