From da4b80ef2f3b3f620237759dfe3d35d346ef346e Mon Sep 17 00:00:00 2001 From: Joe Traver Date: Tue, 18 Oct 2022 23:45:13 -0700 Subject: Added do while loop to set input perameters --- BlankConsoleLab/BlankConsoleLab.cpp | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'BlankConsoleLab/BlankConsoleLab.cpp') 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; - -} -- cgit v1.2.3