The sine Rule

I am basically trying to make a program for a calculator. I am struggling with how to do the sine calculation. this calculation will take place at line 158. Any help will be highly appreciated. Thanks

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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#include <iostream>
#include <cmath>

using namespace std;

int main()

{

         double firstNumber = 0.0;
         double secondNumber = 0.0;
         char operation =' ';

do
{
     cout << "welcome to Calculator++." << endl;
     cout << " " << endl;
     cout << "Select Operation" << endl;
     cout << "1. Standard calculator operations" << endl;
     cout << "2. Trigonometry" << endl;
     cout << "3. Statistics" << endl;

    int M;
    cin >> M;

     if ( M == 1 ){
        cout << " " << endl;
        cout << "1. Addition" << endl;
        cout << "2. Subtraction" << endl;
        cout << "3. Multiplication" << endl;
        cout << "4. Division" << endl;
        cout << "5. Square a number" << endl;
        cout << "6. Cube a number" << endl;
        cout << "7. Exponent's ( X^n)" << endl;
        cout << "8. Squareroot" << endl;
        cout << "9. Cuberoot" << endl;
        cout << "10. Log [log10(x)]" << endl;
        cout << "11. Finding the length of a hypotenuse" << endl;

     }

        {
            int Op;

                cout << " " << endl;
                cout << "Enter first Number" << endl;
                cin>>firstNumber;
                cout << " " << endl;
                cout << "Enter Operation number (1 to 11)" << endl;
                cin>>Op;
                cout << " " << endl;
                cout << "Enter second Number (enter zero for operation 5, 6, 8, 9 & 10)" << endl;
                cin>>secondNumber;
                cout << " " << endl;

                if ( Op == 1){
                    cout << "the answer is..."<<firstNumber<<"+"<<secondNumber<<"="<<(firstNumber+secondNumber) << endl;
                }
                if ( Op == 2){
                    cout << "the answer is..."<<firstNumber<<"-"<<secondNumber<<"="<<(firstNumber-secondNumber) << endl;
                }
                if ( Op == 3){
                    cout << "the answer is..."<<firstNumber<<"*"<<secondNumber<<"="<<(firstNumber*secondNumber) << endl;
                }
                if ( Op == 4){
                    cout << "the answer is..."<<firstNumber<<"/"<<secondNumber<<"="<<(firstNumber/secondNumber) << endl;
                }
                if ( Op == 5){
                    cout << "the answer is..."<<firstNumber<<"*"<<firstNumber<<"="<<(firstNumber*firstNumber) << endl;
                }
                if ( Op == 6){
                    cout << "the answer is..."<<firstNumber<<"*"<<firstNumber<<"*"<<firstNumber<<"="<<(firstNumber*firstNumber*firstNumber) << endl;
                }
                if ( Op == 7){
                    cout << "the answer is..."<<std::pow(firstNumber, secondNumber) << endl;
                    break;
                }
                if ( Op == 8){
                    cout << "the answer is..."<<std::sqrt(firstNumber) << endl;
                    break;
                }
                if ( Op == 9){
                    cout << "the answer is..."<<std::cbrt(firstNumber) << endl;
                    break;
                }
                if ( Op == 10){
                    cout << "the answer is..."<<std::log10(firstNumber) << endl;
                    break;
                }
                if ( Op == 11){
                    cout << "the answer is..."<<std::hypot(firstNumber,secondNumber) << endl;
                    break;
                }
        return 0;
        }

     if ( M == 2 ){
        cout << "1. Cos(angle)" << endl;
        cout << "2. Sin(angle)" << endl;
        cout << "3. Tan(angle)" << endl;
        cout << "4. Sine (find an angle)" << endl;
        cout << "5. Sine (find a length)" << endl;
        cout << "6. Cosine (find an angle)" << endl;
        cout << "7. Cosine (find a length)" << endl;
        cout << "8. Degrees to Raidians" << endl;
        cout << "9. Radians to Degrees" << endl;
        cout << "10. Arc Length" << endl;
        cout << "11. Area of a Sector" << endl;
        cout << "12. Area of a segment in a circle" << endl;
     }
     {
         int Op1;
         int angle;
         int angleA;
         int angleB;
         int angleC;
         int lengthA;
         int lengthB;
         int lengthC;


            cout << " " << endl;
            cout << "Enter Operation number (1 to 12)" << endl;
            cin>>Op1;
            cout << " " << endl;

            if ( Op1 == 1){
                cout << "Enter angle" << endl;
                cin>>angle;
                cout << " " << endl;
                cout << "the answer is..." <<std::cos(angle) << endl;
                break;
            }
            if ( Op1 == 2){
                cout << "Enter angle" << endl;
                cin>>angle;
                cout << " " << endl;
                cout << "the answer is..." <<std::sin(angle) << endl;
                break;
            }
            if ( Op1 == 3){
                cout << "Enter angle" << endl;
                cin>>angle;
                cout << " " << endl;
                cout << "the answer is..." <<std::tan(angle) << endl;
                break;
            }
            if ( Op1 == 4){
                cout << "Enter angle A" << endl;
                cin>>angleA;
                cout << " " << endl;
                cout << "Enter length A" << endl;
                cin>>lengthA;
                cout << " " << endl;
                cout << "Enter length B" << endl;
                cin>>lengthB;
                cout << " " << endl;
                cout << "the answer is..." <<



            }



     }

     if ( M == 3 ){
        cout << "1. " << endl; //*

        cout << "2. " << endl;
        cout << "3. " << endl;
        cout << "4. " << endl;
        cout << "5. " << endl;
        cout << "6. " << endl;
        cout << "7. " << endl;

        return 0;
     }
} while (true);

}
Topic archived. No new replies allowed.