summaryrefslogtreecommitdiff
path: root/BlankConsoleLab/BlankConsoleLab.cpp
diff options
context:
space:
mode:
authorMorgan Cyrus <[email protected]>2022-10-17 22:41:05 -0700
committerMorgan Cyrus <[email protected]>2022-10-17 22:41:05 -0700
commit9604bbb7aa0487c319076a4464dcafcf98483fbb (patch)
tree20fabb31769105009c50ced01e2c1dc8e968dbec /BlankConsoleLab/BlankConsoleLab.cpp
parentkiteCalc() (diff)
downloadcst116-lab1-cyrus-9604bbb7aa0487c319076a4464dcafcf98483fbb.tar.xz
cst116-lab1-cyrus-9604bbb7aa0487c319076a4464dcafcf98483fbb.zip
float
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
-rw-r--r--BlankConsoleLab/BlankConsoleLab.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp
index ba46e62..ce23632 100644
--- a/BlankConsoleLab/BlankConsoleLab.cpp
+++ b/BlankConsoleLab/BlankConsoleLab.cpp
@@ -24,16 +24,34 @@ using std::cout;
using std::cin;
using std::endl;
+float kiteCalc(int wid, int len);
+
int main()
{
- int userIn = 0;
- int kiteWidth = 0;
- int kiteLen = 0;
+ float kiteWidth = 0;
+ 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;
+ cout << "You have entered " << kiteWidth << "cm for kite width, and " << kiteLen << "cm for kite length." << endl;
+
+ kiteArea = kiteCalc(kiteWidth, kiteLen);
+ cout << "The area of the kite, in square meters, is: " << kiteArea << endl;
+
+
+}
+
+int kiteCalc(float wid, float len)
+{
+ //calculate kite area in cm^2
+ float kiteAreaCalc = (wid * len)/2;
+
+ //convert cm^2 to meters^2
+ kiteAreaCalc = kiteAreaCalc / 1000;
+ return kiteAreaCalc;
}