diff options
| author | DoolyBoi <[email protected]> | 2022-10-19 19:48:17 -0700 |
|---|---|---|
| committer | DoolyBoi <[email protected]> | 2022-10-19 19:48:17 -0700 |
| commit | 1f01e5b274a5da501c8505dbf30acfda90bf85ad (patch) | |
| tree | 051e93425d8fde017464be86122c1031670d89a4 /BlankConsoleLab/BlankConsoleLab.cpp | |
| parent | added gitignore (diff) | |
| download | cst116-lab1-abd00l4h-1f01e5b274a5da501c8505dbf30acfda90bf85ad.tar.xz cst116-lab1-abd00l4h-1f01e5b274a5da501c8505dbf30acfda90bf85ad.zip | |
takes user input, calculates area, turns into square meters, tells area to user
Diffstat (limited to 'BlankConsoleLab/BlankConsoleLab.cpp')
| -rw-r--r-- | BlankConsoleLab/BlankConsoleLab.cpp | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/BlankConsoleLab/BlankConsoleLab.cpp b/BlankConsoleLab/BlankConsoleLab.cpp index ed5f807..b20ff5c 100644 --- a/BlankConsoleLab/BlankConsoleLab.cpp +++ b/BlankConsoleLab/BlankConsoleLab.cpp @@ -1,5 +1,19 @@ -// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there. -// +/* +CST116 - C++ Programming +Abdullah Havaldar + +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 + +Input: +width (int), height (int) + +Output: +Area (int/string) +*/ #include <iostream> @@ -11,6 +25,21 @@ using std::endl; int main() { - cout << "Hello World!\n"; + //seting up variables + float length, width, area; + + //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; + + //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; } |