diff options
| author | Evan <[email protected]> | 2022-10-22 21:32:48 -0700 |
|---|---|---|
| committer | Evan <[email protected]> | 2022-10-22 21:32:48 -0700 |
| commit | 4a45c49b455e8f9922cbaaf3a232b990e4cd31d1 (patch) | |
| tree | e89a7bf89ac369779a6ab774924df41151f33de8 /BlankConsoleLab/BlankConsoleLab.cpp | |
| parent | ratio (diff) | |
| download | cst116-lab1-evanmihm-4a45c49b455e8f9922cbaaf3a232b990e4cd31d1.tar.xz cst116-lab1-evanmihm-4a45c49b455e8f9922cbaaf3a232b990e4cd31d1.zip | |
done
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index f64dcd1..3dc248d 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -1,4 +1,5 @@ #include <iostream> +#include <limits> #include <iomanip> using std::cout; using std::cin; @@ -13,13 +14,26 @@ int main() float aspectr; float Mass; - //collects width of kite + //collects width of kite in centimeter also checks if it is in bounds cout << "What is the Width of your kite in centimeters? "; cin >> Width; - //collects length of kite + if (Width < 1 || Width > 400) + { + cout << endl << "Input is too large, please enter a number between 1-400" << endl; + cin.ignore(99, '\n'); + return 1; + } + + //collects length of kite in centimeter also checks if it is in bounds cout << "What is the Length of your kite in centimeters? "; cin >> Length; + if (Length < 1 || Length > 400) + { + cout << "Input is too large, please enter a number between 1-400" << endl; + cin.ignore(99, '\n'); + return 1; + } //equation for area in centimeters then convert to meters Area = (Width * Length) / 2; @@ -39,5 +53,11 @@ int main() else if (aspectr < 1) cout << "Your Aspect Ratio is less than 1, Good!" << endl; + //calculates the gravitational pull on the kite + Mass = Area2 * 135; + cout << "The gravitational pull on your kite is =" << Mass << "Grams" << endl; + + + return 0; }
\ No newline at end of file |