diff options
| -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; + + } + + |