diff options
| author | CEOofOogaBooga <[email protected]> | 2022-10-18 19:57:49 -0700 |
|---|---|---|
| committer | CEOofOogaBooga <[email protected]> | 2022-10-18 19:57:49 -0700 |
| commit | 70f189191b922b7bb38d098cbf342e2a8e38237c (patch) | |
| tree | 19a5cd5e4fc50a09564a268c28553393c6a916fa | |
| parent | PART 1 DONE (diff) | |
| download | cst116-lab1--trinh--70f189191b922b7bb38d098cbf342e2a8e38237c.tar.xz cst116-lab1--trinh--70f189191b922b7bb38d098cbf342e2a8e38237c.zip | |
Width size done
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index a7eb14e..b487b33 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -15,8 +15,13 @@ float area = 0; float ratio = 0; int main() { - cout << "Enter width in cm: "; - cin >> width; + while (width > 400 || 1 > width) + { + cout << "Enter width in cm: "; + cin >> width; + if (width > 400 || 1 > width) + cout << "Number cannot be greater than 400 or less than 1" << endl; + }; cout << "Enter length in cm: "; cin >> length; area = ((length * width)/2.0)/10000.0; |