C++ Program: [Switch] Area Calculation: Circle, Square, Rectangle using switch statement

By: Prof. Dr. Fazal Rehman | Last updated: July 25, 2024

Write a Simple program in C++ to calculate the area of Circle, Square, and Rectangle using switch statement.

Possible Outputs:

Output#1 Choosing Circle:

Choose a shape to calculate its area: 1. Circle 2. Square 3. Rectangle 1 Enter the radius of the circle: 5 Area of the circle: 78.5398

Output#2 Choosing Square:

Choose a shape to calculate its area: 1. Circle 2. Square 3. Rectangle 2 Enter the side length of the square: 7 Area of the square: 49

Output#3 Choosing Rectangle:

Choose a shape to calculate its area: 1. Circle 2. Square 3. Rectangle 3 Enter the length and width of the rectangle: 4 9 Area of the rectangle: 36

Output#4 Invalid Choice (e.g., selecting option 4):

Choose a shape to calculate its area: 1. Circle 2. Square 3. Rectangle 4 Invalid choice.
All Copyrights Reserved 2025 Reserved by T4Tutorials