help me

can some one help me with this, the use has to put in the angle an the opposite
but i dont no how to do the code?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Maths Helper
#include <iostream>
// define identifier PI with a constant
#define PI 3.14159
// define identifier TWO with a constant
#define TWO 2.0

using namespace std;

char menu()
{
    char choice;
    cout<< "\nMaths Helper";
    cout<< "\n\n**************************************\n";
    cout<< "\n\n Please choose one of the following:\n";
    cout<< "\n\n 1 - Area of a circle ";
    cout<< "\n 2 - Circumference of a circle ";
    cout<< "\n 3 - Factorial of a number ";
    cout<< "\n 4 - Hypotenuse of a triangle ";
    cout<< "\n 5 - Exit";
    cout<< "\n\n\n**************************************\n";
    cout<< "\n\n Enter you choice and press return: ";
    cin >> choice;
    return choice;
}

int main()
{
    int num,factorial=1,Angle, Opposite;
    float area, radius, circumference;
    
    char choice;
    
    do
    {
        choice = menu();
        
        switch (choice)
        {
            case '1':
                cout << "\n\nArea of a circle"
                     << "\n\nEnter the radius:";
                cin >> radius;
                // area = PI*radius*radius
                area = PI * radius * radius;
                // circle area
                cout << "\nCircle area = " << area << endl;
                // Pause for user
                system("pause");
            break;             
            case '2':
                cout<< "\n\nCircumference of a circle"
                    <<"\n\nEnter a circumference of a circle:";
                cin>>radius;
                // circumference = 2*PI*radius
                circumference = TWO * PI * radius;
                // circle Circumference
                cout<<"\nCircumference = "<<circumference<<endl;
                // Pause for user
                system("pause");
            break;
            case '3':
                cout<< "\n\nFactorial of a number "
                    <<"\n\nEnter a number to find its factorial:";
                    cin>>num;
                    // a = 1, number less then 1 equals number, increase the number by 1 
                    for(int a=1;a<=num;a++)
                    {
                    // factorial = 1 * 
                    factorial=factorial*a;
                    }
                    //Factorial number
                    cout<<"\n\nFactorial number is ="<<factorial<<endl;
                    // Pause for user
                    system("pause");
                break;
            case '4':
                cout<< "\n\nHypotenuse of a triangle "
                    << "\n\n Enter a Angle:";
                cin>>Angle;
                cout<< "\n\n Enter the Opposite:";
                cin>>Opposite;
                
                system("pause");
                break; 
            case '5':
                cout<< "Exit"; 
                break;
            default:
                cout<< "\nNot a valid choice.";
        }
    } while (choice != '5');

    return 0;
} 
You mean to find the magnitude of the hypotenuse?

Use the cmath header. There are some useful functions in there.
Then you do something like:

sin x=opposite/hyp
=>hyp=opp/sin x

Aceix.
because im new to this is anyone able to edit my code and put what Acelx has said into it?
Topic archived. No new replies allowed.