From 0721c92bd6a87f0ecb0ed6f0d68b8da368fa662a Mon Sep 17 00:00:00 2001 From: DoolyBoi Date: Wed, 19 Oct 2022 20:13:03 -0700 Subject: renamed lab and changed small things in code --- BlankConsoleLab/BlankConsoleLab.cpp | 70 -------------------------------- BlankConsoleLab/CST116-Lab1-Havaldar.cpp | 70 ++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 70 deletions(-) delete mode 100644 BlankConsoleLab/BlankConsoleLab.cpp create mode 100644 BlankConsoleLab/CST116-Lab1-Havaldar.cpp diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp deleted file mode 100644 index 365a0fc..0000000 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -CST116 - C++ Programming -Abdullah Havaldar -abdullah.havaldar@oit.edu - -Purpose: - -The purpose of this code is to find the area for a kite which the user enters the values of the width and height -and give out the area of the kite -*/ - -#include - -using namespace std; - -using std::cout; -using std::cin; -using std::endl; - -int main() -{ - //seting up variables - float length, width, area, aspectRatio, mass, gPull; - bool dimensions = false; - - //keeps on looping until the user inputs a length and a width between 1 and 400 - while (!dimensions) - { - //output prompt for user to enter length and width - cout << "Please enter the length and width of your kite (in that order)." << endl; - cin >> length >> width; - - //output confirmation stating what the user input - cout << "So the length is " << length << "cm and the width is " << width << "cm." << endl; - - if (width > 400 || length > 400 || width < 1 || length < 1) - { - cout << "Please enter a width and length between 1 - 400. " << endl; - } - else { - dimensions = true; - break; - } - } - - //calculating area and turning it to square meteres - area = ((width * length) / 2); - area /= 10000; - - //telling the user how many square meters their kite is - cout << "The area of your kite is " << area << " square meters." << endl; - - //calculating aspect ratio - aspectRatio = width / length; - - //warns user if aspect ratio is greater than or equal to 1 - if (aspectRatio >= 1) - { - cout << "NOTE: A lower aspect ratio (below 1) would provide more stability"; - } - - //calculating mass of kite - mass = (area * 135) / 1000; - - //calculating gravitational pull - gPull = mass * 9.8; - - cout << "Your kite weighs " << gPull << " kg."; -} - diff --git a/BlankConsoleLab/CST116-Lab1-Havaldar.cpp b/BlankConsoleLab/CST116-Lab1-Havaldar.cpp new file mode 100644 index 0000000..365a0fc --- /dev/null +++ b/BlankConsoleLab/CST116-Lab1-Havaldar.cpp @@ -0,0 +1,70 @@ +/* +CST116 - C++ Programming +Abdullah Havaldar +abdullah.havaldar@oit.edu + +Purpose: + +The purpose of this code is to find the area for a kite which the user enters the values of the width and height +and give out the area of the kite +*/ + +#include + +using namespace std; + +using std::cout; +using std::cin; +using std::endl; + +int main() +{ + //seting up variables + float length, width, area, aspectRatio, mass, gPull; + bool dimensions = false; + + //keeps on looping until the user inputs a length and a width between 1 and 400 + while (!dimensions) + { + //output prompt for user to enter length and width + cout << "Please enter the length and width of your kite (in that order)." << endl; + cin >> length >> width; + + //output confirmation stating what the user input + cout << "So the length is " << length << "cm and the width is " << width << "cm." << endl; + + if (width > 400 || length > 400 || width < 1 || length < 1) + { + cout << "Please enter a width and length between 1 - 400. " << endl; + } + else { + dimensions = true; + break; + } + } + + //calculating area and turning it to square meteres + area = ((width * length) / 2); + area /= 10000; + + //telling the user how many square meters their kite is + cout << "The area of your kite is " << area << " square meters." << endl; + + //calculating aspect ratio + aspectRatio = width / length; + + //warns user if aspect ratio is greater than or equal to 1 + if (aspectRatio >= 1) + { + cout << "NOTE: A lower aspect ratio (below 1) would provide more stability"; + } + + //calculating mass of kite + mass = (area * 135) / 1000; + + //calculating gravitational pull + gPull = mass * 9.8; + + cout << "Your kite weighs " << gPull << " kg."; +} + -- cgit v1.2.3