/*--- Week 8 Lab Exercise *** MY GITHUB USERNAME IS: [put YOUR GitHub username here] *** *** Have I successfully logged into the CS50 IDE?: [put YOUR answer here] *** compile this program using: g++ lab8.cpp -o lab8 run using: ./lab8 create example output using: ./lab8 > lab8-out.txt *** by: [put YOUR NAME here] last modified: 2024-10-18 ---*/ #include <cstdlib> #include <iostream> #include <string> #include <cmath> using namespace std; /*--- signature: rect_area: double double -> double purpose: expects a rectangle's length and width, and returns the area of that rectangle tests: rect_area(3.0, 3.1) == 9.3 rect_area(1.5, 4.0) == (1.5 * 4.0) ---*/ double rect_area(double length, double width) { return length * width; } /*--- test the function above, and ALSO print out several other expressions ---*/ int main() { cout << boolalpha; cout << "*** PUT YOUR NAME HERE ***" << endl; cout << "*** Testing: rect_area ***" << endl; cout << (rect_area(3.0, 3.1) == 9.3) << endl; cout << (rect_area(1.5, 4.0) == (1.5 * 4.0)) << endl; cout << endl; cout << "Just to see: " << endl; cout << rect_area(3.0, 3.1) << endl; cout << endl; cout << "OPTIONAL: want to print out an expression's value?\n" << " type it in the parentheses below: " << endl; cout << ("OPTIONAL: desired expression") << endl; cout << endl; return EXIT_SUCCESS; }