diff options
Diffstat (limited to 'BlankConsoleLab')
| -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."; + + } |