diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -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; |