1 // Lab 3 areas.cpp 2 // WRITE A COMMENT BRIEFLY DESCRIBING THE PROGRAM. 3 // PUT YOUR NAME HERE. 4 // INCLUDE ANY NEED
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
1 // Lab 3 areas.cpp 2 // WRITE A COMMENT BRIEFLY DESCRIBING THE PROGRAM. 3 // PUT YOUR NAME HERE. 4 // INCLUDE ANY NEED
STATEMENT HERE TO INPUT THE USER'S MENU CHOICE. // USE AN IF/ELSE IF STATEMENT TO OBTAIN ANY NEEDED INPUT INFORMATION // AND COMPUTE AND DISPLAY THE AREA FOR EACH VALID MENU CHOICE. // IF AN INVALID MENU CHOICE WAS ENTERED, AN ERROR MESSAGE SHOULD // BE DISPLAYED. return 0; Specifications: Create a menu-driven program that finds and displays areas of 3 different objects. The menu should have the following 4 choices: 1 -- square 2 -- circle 3- right triangle 4 -- quit If the user selects choice 1, the program should find the area of a square. If the user selects choice 2, the program should find the area of a circle. If the user selects choice 3, the program should find the area of a right triangle. If the user selects choice 4, the program should quit without doing anything. Sample Run Program to calculate areas of objects 1 -- square circle right triangle. 2 3 4 - quit 2 Radius of the circle: 3.0 Area 28.2743
1 // Lab 3 areas.cpp 2 // WRITE A COMMENT BRIEFLY DESCRIBING THE PROGRAM. 3 // PUT YOUR NAME HERE. 4 // INCLUDE ANY NEEDED FILES HERE. 5 using namespace std; 6 7 int main() 8 { 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 } // DEFINE THE NAMED CONSTANT PI HERE AND SET ITS VALUE TO 3.14159 // DECLARE ALL NEEDED VARIABLES HERE. GIVE EACH ONE A DESCRIPTIVE // NAME AND AN APPROPRIATE DATA TYPE. // WRITE STATEMENTS HERE TO DISPLAY THE 4 MENU CHOICES. // WRITE A