PDA

View Full Version : Area Calculator [C++]



SonniE
05-25-2008, 07:38 AM
might come in handy if you have some geometry homework :Headbang:
Download Here (http://www.megaupload.com/?d=5G2NDZK0)


//SonniE's Area Calculator A WWW.codinghs.COM Original
#include <iostream>
using namespace std;
int main()
{
cout << "Welcome To SonniE's Area Calculator!";
double length, width, side, height, radius, base, area;
char type;
cout << "\n s = square, r = rectangle, c = circle, p = parallelogram t = triangle\n Enter Your Figure: ";
cin >> type;
if (type == 's')
{
cout << "\n Enter the length of a side:";
cin >> side;
area = side * side;
cout << "The Area of your Square is: " << area << "\n";
system("pause");
}
if (type == 'r')
{
cout << "\n Enter The Length of your figure: ";
cin >> length;
cout << "\n Enter The Width of your figure: ";
cin >> width;
area = length * width;
cout << "\n The Area of your Rectangle is: " << area << "\n";
system("pause");
}
if (type == 'c')
{
cout << "\n Enter The Radius of your figure: ";
cin >> radius;
area = radius * radius * 3.141592654;
cout << "\n The Area of your circle is aprox: " << area << "\n";
system("pause");
}
if (type == 'p')
{
cout << "\n Enter The Base of your figure: ";
cin >> base;
cout << "\n Enter The Height of your figure: ";
cin >> height;
area = base * height;
cout << "\n The Area of your Parallelogram is: " << area << "\n";
system("pause");
}
if (type == 't')
{
cout << "\n Enter the Base of your figure: ";
cin >> base;
cout << "\n Enter The Height of your figure: ";
cin >> height;
area = .5 * base * height;
cout << "\n The Area of your Triangle is: " << area << "\n";
system("pause");
}
return 0;
}

Scruffy120
05-25-2008, 09:11 AM
haha, this would come in handy next year when i have geometry....

Hacker117
05-25-2008, 12:14 PM
haha, this would come in handy next year when i have geometry....

what grade are you in? lol


oh and sonnie why dont you use math variables so its like "Length of base: X-13"

;)

SonniE
05-25-2008, 03:03 PM
what do u mean i just tried for making it basic