diff options
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index e192845..e381995 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -1,9 +1,9 @@ /* * BlankConsoleLab.cpp : This file contains the 'main' function.Program execution begins and ends there. -* +* * Morgan Cyrus -* CST116_Lab1_Cyrus -* Kite Lab +* CST116_Lab1_Cyrus +* Kite Lab */ #include <iostream> @@ -21,10 +21,20 @@ int main() float kiteLen = 0; float kiteArea = 0; - cout << "Enter value for kite width in cm: "; - cin >> kiteWidth; - cout << endl << "Enter value for kite length in cm: "; - cin >> kiteLen; + // get user input for kiteWidth. Value entered must be between 1 and 400 or it will loop and ask again. + while(kiteWidth < 1 || kiteWidth > 400) + { + cout << "Enter value for kite width in cm between 1 and 400 cm: "; + cin >> kiteWidth; + } + + // get user input for kiteLen. Value entered must be between 1 and 400 or it will loop and ask again. + while(kiteLen < 1 || kiteLen > 400) + { + cout << endl << "Enter value for kite length in cm: "; + cin >> kiteLen; + } + cout << "\nYou have entered " << kiteWidth << "cm for kite width, and " << kiteLen << "cm for kite length." << endl; |