#include "stdafx.h"
#include <iostream>
usingnamespace std;
constfloat pi = 3.14159265;
int main ()
{
float base;
float height;
float width;
float length;
float result;
float rad;
float area;
float diam;
char choice;
cout << "************************************************\n";
cout << ">>>>>>>still didnt decide on a name>>>>>>>>>>>>>\n";
cout << "************************************************\n";
cout << "When entering your measurements, please do not\n\tinclude your unit of measure.\nAlso please make sure you type your choice\n\t in capital letters.\n";
cout << "************************************************\n";
cout << "What kind of equasion do you want to solve?:\n";
cout << " \n";
cout << "- Area of a rectangle: (A)\n";
cout << "- Area of a triangle: (B)\n";
cout << "- Area of a circle: (C)\n";
cout << "- Circumference of a circle: (D)\n";
cout << "- Volume of a rectangular prism: (E)\n";
cout << "- Volume of a triangular prism: (F)\n";
cout << "- Volume of a cylinder: (G)\n";
cout << "- Surface area of a rectangular prism: (H)\n";
cout << "************************************************\n\n";
cout << "Your choice : ";
cin >> choice;
switch (choice)
{
case'A':
cout << "What is the rectangle's base?: ";
cin >> base;
cout << "What is it's height?: ";
cin >> height;
result = base*height;
cout << "The area of the rectangle is ";
cout << result;
cout << " square units.";
break;
case'B':
cout << "What is the triangle's base?: ";
cin >> base;
cout << "What is it's height?: ";
cin >> height;
result = (base*height)/2;
cout << "The area of the triangle is ";
cout << result;
cout << " square units.";
break;
case'C':
cout << "What is the circle's diameter?: ";
cin >> diam;
rad = diam / 2;
result = (rad*rad)*pi;
cout << "The area of the circle is ";
cout << result;
cout << " square units.";
break;
case'D':
cout << "What is the circle's diameter?: ";
cin >> diam;
rad = diam / 2;
result = (2*pi)*rad;
cout << "The circumference of the circle is ";
cout << result;
cout << " units.";
break;
case'E':
cout << "What is the rectangular prism's width?: ";
cin >> width;
cout << "What is the rectangular prism's height?: ";
cin >> height;
cout << "It's length?: ";
cin >> length;
result = length*width*height;
cout << "The volume the of rectangular prism is ";
cout << result;
cout << " cubic units.";
break;
case'F':
cout << "What is the triangular prism's width?: ";
cin >> width;
cout << "What is the triangular prism's height?: ";
cin >> height;
cout << "It's length?: ";
cin >> length;
result = (length*width*height)/2;
cout << "The volume the of triangular prism is ";
cout << result;
cout << " cubic units.";
break;
case'G':
cout << "What is the diameter of the base circle?: ";
cin >> diam;
rad = diam / 2;
area = (rad*rad)*pi;
cout << "What is the height of the cylinder?: ";
cin >> height;
result = area*height;
cout << "The volume of the cylinder is ";
cout << result;
cout << " cubic units.";
break;
case'H':
cout << "What is the length of the prism: ";
cin >> length;
cout << "What is it's depth?: ";
cin >> width;
cout << "What is it's height?: ";
cin >> height;
result = (length * height * 2) +
(width * height * 2 ) +
(length * width * 2);
cout << "The surface area of the rectangular prism is ";
cout << result;
cout << " square units.";
default:
break;
}
cout << "\n\ntype thanks or any random text to end :P\n\n" ;
char f;
cin >> f;
return 0;
}
>.< im still preaty new to programing, all i preaty much know is from antiRTFM videos on youtube... im learning C right now, but all the %d and %f get confusing when i put them in the scanf and printf statements