diff options
| author | jacobdw22 <[email protected]> | 2022-10-17 19:20:04 -0700 |
|---|---|---|
| committer | jacobdw22 <[email protected]> | 2022-10-17 19:20:04 -0700 |
| commit | 673d28679daca8581b1d9aa7a1b954f75373b27c (patch) | |
| tree | 449257dd1294dfe1630e28076f1c5bf7c48ac169 | |
| parent | Part 1 Semi-Final Change (diff) | |
| download | cst116-lab1-jacobdw22-673d28679daca8581b1d9aa7a1b954f75373b27c.tar.xz cst116-lab1-jacobdw22-673d28679daca8581b1d9aa7a1b954f75373b27c.zip | |
simple changes
| -rw-r--r-- | BlankConsoleLab/cst116-lab1-wilson.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/BlankConsoleLab/cst116-lab1-wilson.cpp b/BlankConsoleLab/cst116-lab1-wilson.cpp index f71b36c..cc076b2 100644 --- a/BlankConsoleLab/cst116-lab1-wilson.cpp +++ b/BlankConsoleLab/cst116-lab1-wilson.cpp @@ -14,13 +14,24 @@ int main() float width = 0; float length = 0; float area; + const int mass = 0; float aspect_ratio; - cout << "What is the width of the kite in centimeters: "; - cin >> width; - - cout << "What is the length of the kite in centimeters: "; - cin >> length; + while (true) { + cout << "What is the width of the kite in centimeters: "; + if (cin >> width && (width >= 1 && width <= 400)) { + break; + } + cout << "Please enter a number between 1 and 400 centimeters." << endl; + } + + while (true) { + cout << "What is the length of the kite in centimeters: "; + if (cin >> length && (length >= 1 && length <= 400)) { + break; + } + cout << "Please enter a number between 1 and 400 centimeters." << endl; + } cout << "The width is " << width << " centimeters and the length is " << length << " centimeters." << endl; @@ -36,5 +47,7 @@ int main() else if (aspect_ratio < 1) cout << "Aspect ratio < 1. Good aspect ratio."; + + } |