Advertisement
Guest User

ques3

a guest
Nov 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <iostream>
  2. # define pi 3.1416
  3. # define circle 1
  4. # define rectangle 2
  5. # define square 3
  6.  
  7.  
  8. using namespace std;
  9.  
  10.  
  11. int main(void)
  12. {
  13.     int choice;
  14.     float dim1, dim2;
  15.  
  16.         cout << "\n\n\n\n\n";
  17.         cout << "\t\t\t\tEnter 1 for circle\n ", circle;
  18.         cout << "\t\t\t\tEnter 2 for rectangle\n", rectangle;
  19.         cout << "\t\t\t\tEnter 3 for suqare\n", square;
  20.         cin >> choice;
  21.  
  22.         if (choice == 1) {
  23.             cout << "Enter the radius: ";
  24.             cin >> dim1;
  25.             cout << "The shape is a circle with the radius\n ", dim1;
  26.             cout << "The area is ", dim1* dim1* pi;
  27.         }
  28.         else if (choice == 2) {
  29.             cout << "Enter the side: ";
  30.             cout << "The shape is a square with side ", dim1;
  31.             cout << "The area is\n", dim1* dim1;
  32.         }
  33.         else if (choice == 3) {
  34.             cout << "Enter the length and width";
  35.             cin >> dim1 >> dim2;
  36.             cout << "The shape is a rectangle";
  37.             cout << "Length and width " << dim1 << "and" << dim2;
  38.             cout << "The area is \n", dim1* dim1;
  39.         }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement