Question: Find two syntax errors in the following program: #include using namespace std; int area(int length, int width = 0); int main() { int length, width;

Find two syntax errors in the following program: #include using namespace std; int area(int length, int width = 0); int main() { int length, width; // for rectangle use both arguments cout << "Enter length and width of a rectangle" << endl; cin >> length >> width; cout << "The area is " << area(length, width) << endl; // for square, only need first argument cout << "Enter side of a square" << endl; cin >> length; cout << "The area is " << area(length) << endl; return 0; } int area(int length, int width = 0); { if ( width == 0 ) return length * length; return length * width; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!