diff options
| author | Joe Traver <[email protected]> | 2022-10-18 23:45:13 -0700 |
|---|---|---|
| committer | Joe Traver <[email protected]> | 2022-10-18 23:45:13 -0700 |
| commit | da4b80ef2f3b3f620237759dfe3d35d346ef346e (patch) | |
| tree | 4b662387e1170f2ffe8f14b6a1e67986441ffd95 | |
| parent | Part 1 Finished. Changed width var to float to accommodate tiny kites that ha... (diff) | |
| download | cst116-lab1-joetraver30-da4b80ef2f3b3f620237759dfe3d35d346ef346e.tar.xz cst116-lab1-joetraver30-da4b80ef2f3b3f620237759dfe3d35d346ef346e.zip | |
Added do while loop to set input perameters
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ac5d528..0705133 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -18,36 +18,41 @@ int main() float ratio; - cout << "Enter Length of kite in cm: "; - cin >> length; + do + { + cout << "Enter Length of kite in cm: "; + cin >> length; - cout << "Enter Width of kite in cm: "; - cin >> width; + cout << "Enter Width of kite in cm: "; + cin >> width; - cout << "Length = " << length << " cm" << endl; + cout << "Length = " << length << " cm" << endl; - cout << "Width = " << width << " cm" << endl; + cout << "Width = " << width << " cm" << endl; + } while ((length < 1 || length > 400) || (width < 1 || width > 400)); + - -// area calculation + // area calculation area = (length * width) / 2; -// unit conversion + // unit conversion meters = area / 10000; cout << "Kite area: " << meters << " square meters" << endl; -// aspect ratio + // aspect ratio ratio = width / length; - if (ratio > 1) - cout << "WARNING! A lower aspect ratio would provide more stability" << endl; + if (ratio > 1) + cout << "WARNING! A lower aspect ratio would provide more stability" << endl; + + + return 0; +} + - return 0; - -} |