/***************************************************
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.14
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>
using namespace std;
int main()
{
// Read type of object: circle or triangle
string s;
cin >> s;
if (s == "circle")
{
// Compute area of circle
double r,Pi;
Pi = 3.14;
cin >> r;
cout << "Area equals " << Pi*r*r << endl;
}
else
{
// Compute area of triangle
double b,h;
cin >> b >> h;
cout << "Area equals " << 1/2.0*b*h << endl;
}
return 0;
}