diff options
| author | huntbyrne <[email protected]> | 2022-10-27 14:35:50 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-10-27 14:35:50 -0700 |
| commit | 4cd086fbda16e6dc6194744835da81066ca16b8b (patch) | |
| tree | d50b14d9fe89fdd7b53760bae09972c6e3686203 | |
| parent | simple changes (diff) | |
| download | cst116-lab1-huntbyrne-4cd086fbda16e6dc6194744835da81066ca16b8b.tar.xz cst116-lab1-huntbyrne-4cd086fbda16e6dc6194744835da81066ca16b8b.zip | |
Update CST116-Lab1-Byrne.cpp
| -rw-r--r-- | BlankConsoleLab/CST116-Lab1-Byrne.cpp | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/BlankConsoleLab/CST116-Lab1-Byrne.cpp b/BlankConsoleLab/CST116-Lab1-Byrne.cpp index 944f5e8..7d21fe1 100644 --- a/BlankConsoleLab/CST116-Lab1-Byrne.cpp +++ b/BlankConsoleLab/CST116-Lab1-Byrne.cpp @@ -1,30 +1,67 @@ -// BlankConsoleLab.cpp : This file contains the 'main' function. Program execution begins and ends there. -// - #include <iostream> -using namespace std; + using namespace std; + using std::cout; + using std::cin; + using std::endl; -int main() -{ - // Following code is to find the area of the kite - int length = 0; - int width = 0; - float area = (length * width) +int + length = 0; - // Asking the user to input the length and width in centimetres - cout << "What is the length of the kite in cm?\n" - cin >> length; - - cout << "What is the width of the kite in cm? \n" - cin >> width; +int + width = 0; - return area; +int + area = ((length * width) / 2); + +int +main () +{ + + // Following code is to find the area of the kite + + + // Asking the user to input the length and width in centimetres + cout << "What is the length of the kite in cm?\n"; + +cin >> length; + + +cout << "What is the width of the kite in cm? \n"; + +cin >> width; + + +if (length || width >= 401) + { + +cout << "Measurement too big. Enter a number between 0-400 \n"; + +} + + else + { + +cout << "The Area of the kite is: \n" << ((length * width) / + 2) << "centimetres \n"; + +cout << "In Square centimetres this is: \n" << (((length * width) / 2) + / + 10000) << + " Square Meters! \n"; + +} + +return area; + + } + + |