Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- # define pi 3.1416
- # define circle 1
- # define rectangle 2
- # define square 3
- using namespace std;
- int main(void)
- {
- int choice;
- float dim1, dim2;
- cout << "\n\n\n\n\n";
- cout << "\t\t\t\tEnter 1 for circle\n ", circle;
- cout << "\t\t\t\tEnter 2 for rectangle\n", rectangle;
- cout << "\t\t\t\tEnter 3 for suqare\n", square;
- cin >> choice;
- if (choice == 1) {
- cout << "Enter the radius: ";
- cin >> dim1;
- cout << "The shape is a circle with the radius\n ", dim1;
- cout << "The area is ", dim1* dim1* pi;
- }
- else if (choice == 2) {
- cout << "Enter the side: ";
- cout << "The shape is a square with side ", dim1;
- cout << "The area is\n", dim1* dim1;
- }
- else if (choice == 3) {
- cout << "Enter the length and width";
- cin >> dim1 >> dim2;
- cout << "The shape is a rectangle";
- cout << "Length and width " << dim1 << "and" << dim2;
- cout << "The area is \n", dim1* dim1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement