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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started