/***************************************************
Areas of Circles and Triangles
Write a program that calculates areas of circles
and triangles, where the use chooses which kind of
object he wants to caclulate areas for.
The area of a circle is Pi r^2, where r is the
radius and Pi is approximately 3.14159265358979324.
The area of a triangle is 1/2 b h, where b is the
length of the base, and h is the height.
***************************************************/
**#include <iostream>**
**#include <string>**
**using** **namespace** std;
**int** main()
**{**
// Read type of object: circle or triangle
string s;
cout << "Do you have a circle or a triangle? ";
cin >> s;
**if** (s == "circle")
**{**
// Compute area of circle
**double** r,Pi;
Pi = 3.14159265358979324;
cout << "Enter the radius of your circle: ";
cin >> r;
cout << "Area equals " << Pi*r*r << endl;
**}**
**else**
**{**
// Compute area of triangle
**double** b,h;
cout << "Enter base length: ";
cin >> b;
cout << "Enter height: ";
cin >> h;
cout << "Area equals " << 1/2.0*b*h << endl;
**}**
**return** 0;
**}**