View difference between Paste ID: 2SJT3yp0 and JCxtWJ6g
SHOW: | | - or go back to the newest paste.
1
#include <cstdlib>
2
#include <iostream>
3
#include <math.h>
4
#define RADTODEG(Rad) ((180.0 * Rad) / PI)
5
#define PI 3.14159
6
7
using namespace std;
8
9
int main(int argc, char *argv[])
10
11
{
12
   float a;
13
   float b;
14
   float c;
15
   float d; //angle
16
   float e; //opposite
17
   float f; 
18
   float g;
19
   float h;
20
   int n;
21
   int o;
22
    
23
    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";
24
    cin >> a;
25
   
26
    if (a==1){
27
       cout << "Please Input the radius of the Circle\n";
28
       cin >> b;
29
       c = (2*PI*b);
30
       cout << "The Circumference of the circle is :";
31
       cout << c;
32
       }
33
    else if (a==2){
34
       cout << "Please Input the radius of the Circle\n";
35
       cin >> b;
36
       c = (PI*(b*b));
37
       cout << "The Area of the circle is :";
38
       cout << c;
39
       }
40
    else if (a==3){
41
       cout << "Please input Angle";
42
       cin >> d;
43
       cout << "Please input Opposite";
44
       cin >> e;
45
       g = sin(d*PI/180);
46
       h = (e/g);
47
       cout << h;
48
       }
49
       //IAN AFTER THIS POINT IS WHERE I NEED TO PUT IT   
50
    else if (a==4){
51-
        cout << "Please input a number";
51+
        cout << "Please input a number: ";
52
        cin >> n;
53
54
        if (n < 1)
55
        {
56
            cout << "Sorry, number must be positive.\n";
57
        }
58
        else if (n > 65)
59
        {
60
            cout << "Sorry, can't handle a number bigger than 65 with only 64 bits for the result\n";
61
        }
62
        else
63
        {
64
            factorial=1;
65
            for (i=n; i>0; i--)
66
            {
67
                factorial *= i;
68
            }
69
            cout << "The factorial of " << n << " is " << factorial << "\n";
70
        }
71
    else cout << "Incorrect Input";
72
}