Question: Question text Write the necessary functions for the following program. Do not change main, just write the functions. Area of a rectangle is length *
Question text Write the necessary functions for the following program. Do not change main, just write the functions. Area of a rectangle is length * width. Area of a square is side * side; getNumber returns a positive integer (validates as needed) #include using namespace std; int main() { cout << "Enter length and width of a rectangle: "; int length = getNumber(); int width = getNumber(); cout << "Its area is " << area(length, width) << endl; cout << "Enter the side of a square "; int side = getNumber(); cout << "Its area is " << area(side) << endl; return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
