diff options
| author | Morgan Cyrus <[email protected]> | 2022-10-17 22:43:37 -0700 |
|---|---|---|
| committer | Morgan Cyrus <[email protected]> | 2022-10-17 22:43:37 -0700 |
| commit | 25a86fd5d00ff99943db4bc8aca30c0212b4e945 (patch) | |
| tree | 877ea765e3a09300208ebc7309a97bccaf43af4b | |
| parent | float (diff) | |
| download | cst116-lab1-cyrus-25a86fd5d00ff99943db4bc8aca30c0212b4e945.tar.xz cst116-lab1-cyrus-25a86fd5d00ff99943db4bc8aca30c0212b4e945.zip | |
Fixed float
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 6 | ||||
| -rw-r--r-- | enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp | 58 |
2 files changed, 3 insertions, 61 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ce23632..ed7af6e 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -24,7 +24,7 @@ using std::cout; using std::cin; using std::endl; -float kiteCalc(int wid, int len); +float kiteCalc(float wid, float len); int main() { @@ -37,7 +37,7 @@ int main() 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; + cout << "\nYou 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; @@ -45,7 +45,7 @@ int main() } -int kiteCalc(float wid, float len) +float kiteCalc(float wid, float len) { //calculate kite area in cm^2 float kiteAreaCalc = (wid * len)/2; diff --git a/enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp b/enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp deleted file mode 100644 index fd323c3..0000000 --- a/enc_temp_folder/4a6b77e0fedc921ffc7ed9166cca4d28/BlankConsoleLab.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* -* BlankConsoleLab.cpp : This file contains the 'main' function.Program execution begins and ends there. -* -* Morgan Cyrus -* CST116_Lab1_Cyrus -* Kite Lab -* -* Note: This has been put in order of completion. Do one step and then compile / check it. -* -* Ask the user for the width and length in centimeters. -* Print what the user entered for the width and length. -* Compute the area of the kite. Area = (width × length)/ 2 -* Convert the square centimeters to square meters by dividing by 10000. -* Print area in square meters. Note: square meters will use decimals. -* Compute the aspect ratio of the kite. The aspect ratio is width / length -* If the aspect ratio is greater than or equal to 1, print a warning message that a lower aspect ratio would provide more stability. -* -* Your output should be self-documenting. In other words, it should show the input with labels and then the output. You can see some examples of final outputs at the end. -*/ - -#include <iostream> - -using std::cout; -using std::cin; -using std::endl; - -int kiteCalc(int wid, int len); - -int main() -{ - int userIn = 0; - int kiteWidth = 0; - int 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(int wid, int len) -{ - //calculate kite area in cm^2 - float kiteAreaCalc = (wid * len)/2; - - //convert cm^2 to meters^2 - kiteAreaCalc = kiteAreaCalc / 1000; - - return kiteAreaCalc; -} |