summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authortwsta <twsta@TRENTON-PC-V2>2022-10-11 20:05:40 -0700
committertwsta <twsta@TRENTON-PC-V2>2022-10-11 20:05:40 -0700
commit78bdf36f3c9ea3181c1aef01151e90c745ee2a2e (patch)
tree6732de98af5dfb3b258f46d890d51a85df600bdd /BlankConsoleLab/BlankConsoleLab.cpp
parentadded warning message for high ratios (diff)
downloadcst116-lab1-stark-78bdf36f3c9ea3181c1aef01151e90c745ee2a2e.tar.xz
cst116-lab1-stark-78bdf36f3c9ea3181c1aef01151e90c745ee2a2e.zip
added checks for too large and too small dimensions
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index da5b275..fca81a9 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -8,18 +8,32 @@ int main()
float area, ratio;
cout << "Kite Math 0.2" << endl;
- cout << "Please input the width of your kite:" << endl;
- cin >> width;
- cout << "Please input the length of your kite:" << endl;
- cin >> length;
- cout << endl;
+
+ do {
+ cout << "Input the width of your kite:" << endl;
+ cin >> width;
+ if (width < 1 || width > 400)
+ cout << "Input a valid number." << endl;
+ cout << endl;
+ } while (width < 1 || width > 400);
+
+ do {
+ cout << "Input the length of your kite:" << endl;
+ cin >> length;
+ if (length < 1 || length > 400)
+ cout << "Input a valid number." << endl;
+ cout << endl;
+ } while (length < 1 || length > 400);
+
cout << "Width: " << width << endl;
cout << "length: " << length << endl;
+
area = (width * length) / 2;
area = area / 10000;
ratio = width / length;
+ cout << "Ratio: " << ratio << endl;
if (ratio >= 1) {
cout << "A lower aspect ratio may provide more kit stability" << endl;
}