From 4cd086fbda16e6dc6194744835da81066ca16b8b Mon Sep 17 00:00:00 2001 From: huntbyrne <114624182+huntbyrne@users.noreply.github.com> Date: Thu, 27 Oct 2022 14:35:50 -0700 Subject: Update CST116-Lab1-Byrne.cpp --- BlankConsoleLab/CST116-Lab1-Byrne.cpp | 71 ++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 17 deletions(-) (limited to 'BlankConsoleLab/CST116-Lab1-Byrne.cpp') 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 -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; + + } + + -- cgit v1.2.3