Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdlib>
- #include <iostream>
- #include <math.h>
- #define RADTODEG(Rad) ((180.0 * Rad) / PI)
- #define PI 3.14159
- using namespace std;
- int main(int argc, char *argv[])
- {
- float a;
- float b;
- float c;
- float d; //angle
- float e; //opposite
- float f;
- float g;
- float h;
- int n;
- int o;
- cout << "Please select on of the following options \n 1. Calculate the circumference of a circle \n 2. The area of a circle \n 3. The Hypotenuse of a triangle and the Opposite \n 4. Calculate the factorial of a Number.\n";
- cin >> a;
- if (a==1){
- cout << "Please Input the radius of the Circle\n";
- cin >> b;
- c = (2*PI*b);
- cout << "The Circumference of the circle is :";
- cout << c;
- }
- else if (a==2){
- cout << "Please Input the radius of the Circle\n";
- cin >> b;
- c = (PI*(b*b));
- cout << "The Area of the circle is :";
- cout << c;
- }
- else if (a==3){
- cout << "Please input Angle";
- cin >> d;
- cout << "Please input Opposite";
- cin >> e;
- g = sin(d*PI/180);
- h = (e/g);
- cout << h;
- }
- //IAN AFTER THIS POINT IS WHERE I NEED TO PUT IT
- else if (a==4){
- cout << "Please input a number: ";
- cin >> n;
- if (n < 1)
- {
- cout << "Sorry, number must be positive.\n";
- }
- else if (n > 65)
- {
- cout << "Sorry, can't handle a number bigger than 65 with only 64 bits for the result\n";
- }
- else
- {
- factorial=1;
- for (i=n; i>0; i--)
- {
- factorial *= i;
- }
- cout << "The factorial of " << n << " is " << factorial << "\n";
- }
- else cout << "Incorrect Input";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement