Question: #include using namespace std; int main() { int choice = 0; float rad; float area = 0; float width, length, height; while (choice != 4)
#include using namespace std; int main() { int choice = 0; float rad; float area = 0; float width, length, height; while (choice != 4) { cout << " 1. Enter the radius of a circle" << endl; cout << " 2. Enter the width of a rectangle" << endl; cout << " 3. Enter the length of a triangle " << endl; cout << " 4. quit " << endl; cout << " Enter choice: " << endl; cin >> choice; } if (choice == 1) { cout << " enter radius: "; cin >> rad; } while (rad < 0) area = 3.14159 * (rad * rad); cout << " area is: " << area; else if (choice == 2) { cout << "enter the length and width: "; cin >> length, width; } while (length, width < 0) area = length * width; cout << "the area is : " << area << endl; else if (choice == 3); { cout << "enter the length of the triangles" << length << endl; cin >> length; cout << "enter the height" << height << endl; cin >> height; } area = length * height / 2; cout << " area is:" << area << endl; cin >> area; else if (choice == 4) { cout << " goodbye " !!<< endl; break; } else { cout << " invalid choice " << endl; cout << endl; } system("pause"); return 0; }
c++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
