What is the reason for the wrong operation of trigonometric function in calculator (scientific calculator) for example, if I input sin30 directly, the answer is 0.45

What is the reason for the wrong operation of trigonometric function in calculator (scientific calculator) for example, if I input sin30 directly, the answer is 0.45


There are many units of angle. In China, "degrees" is used. The circumference angle is 360 degrees. Sin (30 degrees, DEG) = 0.5
European countries use "Ge", the circumference angle is 400 Ge, sin (30 Ge, GRA) = 0.4539904997
There is also radian rad, circumference angle 2pi, sin (30) = - 0.9880316241
There must be something wrong with the unit setting. On the computer, DEG is abbreviated as D, GRA is abbreviated as G, RAD is abbreviated as R



Scientific calculator trigonometric function calculation result is wrong, how to do
The result of trigonometric function of scientific calculator is different from the actual result. What should we do?


Scientific calculator is unlikely to make a mistake. It may be something wrong. If it is, drop it and see if it can't accept it



C language calculator program design includes simple function operation of addition, subtraction, multiplication and division


Program design of practical calculator
[Abstract] conception and design code of multi purpose calculator
[Key words] multi purpose calculator; design
Numerical calculation can be said to be the most frequent work in daily life. Win98 provides "calculator" software for users. The software can handle general one-step four arithmetic operations, such as 3 + 2, 5 / 3, etc., but users often encounter multi-step four arithmetic operations in daily life, such as 3 + 4 * 5-4 / 2, 45 * 34 / 2 + 18 * 7, etc., so the calculator is not competent, The author has made a practical calculator, which has many new functions: (the program interface is shown in the figure)
1. It can realize four continuous operations
2. It can display the input formula
3. It is convenient to calculate personal income tax
4. Both mouse and keyboard can input data
5. Friendly operation interface
6. Click the key to make sound
The core problems needed to be studied and solved in the construction of this calculator are as follows: 1. Multiplication evaluation? 2. Character display? 3. Keyboard input? 4. Keystroke sound? 5. Personal income tax laws and regulations. In order to make people have a better understanding of the program, the code is provided to readers for reference
*Define array and form variables
Dim number2(0 To 50) As Double
Dim number(0 To 50) As Double
Dim z As Integer
Dim k As Integer, r As Integer
Dim j As Integer
Dim str As String
*Call the API function named "playsound"
Private Declare Function PlaySound Lib " winmm.dll " Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ FILENAME = &H20000?
Private Const SND_ ASYNC = &H1?
Private Const SND_ SYNC = &H0
*Judge the general process
Sub pianduan(p As String)
r = 0
Dim i As Integer, l As Integer, h As Integer
h = 0
i = 1
If InStr(Trim$(p), "*") 0 Then
k = k + 1
End If
If InStr(Trim$(p), "/") 0 Then
r = r + 1
End If
End Sub
*The general process of tandem
*Event process of each button
Private sub Command1_ Click(Index As Integer)
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Text1.Text = Text1.Text + Command1(Index).Caption
Text2.Text = Text2.Text + Command1(Index).Caption
Text1.SetFocus
End Sub
rivate sub Command10_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
str = Text3.Text
End Sub
Private sub Command11_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Text3.Text = str
End Sub
rivate sub Command2_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Dim totle As Double
Dim n As Integer
Call pianduan(Text1.Text)
If k >= 1 Or r >= 1 Then
Call liancheng(totle)
number2(z) = totle
If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then
number2(z) = -totle
End If
k = 0: r = 0
Else
number2(z) = Val(Text1.Text)
End If
Text1.Text = ""
Text2.Text = Text2 + "+"
z = z + 1
Text1.SetFocus
End Sub
rivate sub Command3_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Dim totle As Double
Dim n As Integer
Call pianduan(Text1.Text)
If k >= 1 Or r >= 1 Then
Call liancheng(totle)
number2(z) = totle
If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then
number2(z) = -totle
End If
k = 0: r = 0
Else
number2(z) = Val(Text1.Text)
End If
Text1.Text = ""
Text2.Text = Text2 + "-"
Text1.Text = Text1.Text & "-"
z = z + 1
Text1.SetFocus
End Sub
Private sub Command4_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Text2.Text = Text2.Text + "*"
Text1.Text = Text1.Text + "*"
Text1.SetFocus
End Sub
rivate sub Command5_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Text2.Text = Text2 + "/"
Text1.Text = Text1 + "/"
Text1.SetFocus
End Sub
Private sub Command6_ Click()
PlaySound App.Path & "\ sound.wav ", 0, SND_ SYNC
Dim totle As Double
Dim n As Integer
Call pianduan(Text1.Text)
If k >= 1 Or r >= 1 Then
Call liancheng(totle)
number2(z) = totle
If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then
number2(z) = -totle
End If
k = 0: r = 0
Else
number2(z) = Val(Text1.Text)
End If
Text1.Text = ""
z = z + 1
Dim dengyu As Double
Dim v As Integer
For v = 0 To 50
dengyu = dengyu + number2(v)
Next v
If dengyu < 0 Then
Text3.ForeColor = &HFF&
Else
Text3.ForeColor = &HFF0000
End If
Text3.Text = dengyu
Text1.SetFocus
If Len(Text3.Text) >= 14 Then
calcresult.Show
End If
End Sub
rivate sub Command7_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
z = 0: k = 0: r = 0: j = 0
Dim i As Integer
For i = 0 To 50
number(i) = 0
number2(i) = 0
Next i
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End Sub
rivate sub Command8_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
If Val(Text3.Text) = 0 Then
Msgbox "divisor cannot be 0!"
Exit Sub
End If
Text3.Text = 1 / Val(Text3.Text)
End Sub
Private sub Command9_ Click()
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Text3.ForeColor = &HFF0000
Text3.Text = Val(Text3.Text) * Val(Text3.Text)
End Sub
rivate sub muninternet_ Click()
Dim i
i = Shell("C:\Program Files\InternetExplorer\ iexplore.exe ", vbMaximizedFocus)
End Sub
rivate sub munmp3_ Click()
Dim i
i = Shell("C:\Program Files\Windows Media Player\mplayer2", vbNormalNoFocus)
End Sub
Private sub munsm_ Click()
Dialog.Show
End Sub
rivate sub muntax_ Click()
tax.Show
End Sub
rivate sub munver_ Click()
ver.Show
End Sub
rivate sub notepad_ Click()
Dim i
i = Shell("c:\windows\notepad", vbNormalFocus)
End Sub
Private sub Text1_ KeyPress(KeyAscii As Integer)
PlaySound App.Path & "\ start.wav ", 0, SND_ SYNC
Dim num As Integer
num = Val(KeyAscii)
If num > 47 And num < 58 Then
Text1.Text = Text1.Text + CStr(num - 48)
Text2.Text = Text2.Text + CStr(num - 48)
End If
If num = 46 Then
Text1.Text = Text1.Text + "."
Text2.Text = Text2.Text + "."
End If
If KeyAscii = 43 Then
Dim totle As Double
Dim n As Integer
Call pianduan(Text1.Text)
If k >= 1 Or r >= 1 Then
Call liancheng(totle)
number2(z) = totle
If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then
number2(z) = -totle
End If
k = 0: r = 0
Else
number2(z) = Val(Text1.Text)
End If
Text1.Text = ""
Text2.Text = Text2 + "+"
z = z + 1
End If
If KeyAscii = 45 Then
Call pianduan(Text1.Text)
If k >= 1 Or r >= 1 Then
Call liancheng(totle)
number2(z) = totle
If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then
number2(z) = -totle
End If
k = 0: r = 0
Else
number2(z) = Val(Text1.Text)
End If
Text1.Text = ""
Text2.Text = Text2 + "-"
Text1.Text = Text1.Text & "-"
z = z + 1
End If
If KeyAscii = 42 Then
Text2.Text = Text2.Text + "*"
Text1.Text = Text1.Text + "*"
End If
If KeyAscii = 47 Then
Text2.Text = Text2.Text + "/"
Text1.Text = Text1.Text + "/"
End If
If KeyAscii = vbKeyReturn Then
PlaySound App.Path & "\ sound.wav ", 0, SND_ SYNC
Call pianduan(Text1.Text)
If k >= 1 Or r >= 1 Then
Call liancheng(totle)
number2(z) = totle
If Mid$(Trim$(Text1.Text), 1, 1) = "-" Then
number2(z) = -totle
End If
k = 0: r = 0
Else
number2(z) = Val(Text1.Text)
End If
Text1.Text = ""
z = z + 1
Dim dengyu As Double
Dim v As Integer
For v = 0 To 50
dengyu = dengyu + number2(v)
Next v
If dengyu < 0 Then
Text3.ForeColor = &HFF&
Else
Text3.ForeColor = &HFF0000
End If
Text3.Text = dengyu
End If
If KeyAscii = vbKeyEscape Then
z = 0: k = 0: r = 0: j = 0
Dim i As Integer
For i = 0 To 50
number(i) = 0
number2(i) = 0
Next i
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End If
If Len(Text3.Text) >= 14 Then
calcresult.Show
End If
End Sub
rivate sub Text3_ Change()
tax2.Text1 = Text3.Text
End Sub



A simple calculator program is designed with C language. It can do simple addition, subtraction, multiplication and division according to the operation instruction and data input by keyboard
(1) Basic requirements
(a) Topic analysis and requirements:
1. Be able to realize basic addition, subtraction, multiplication and division operations
2. The program should have the function that the user chooses whether to continue the formula calculation. If y is selected, it means to continue the formula calculation. If n is selected, it means to exit the program
3. Input data requirements: first input the first data, then input the operator, and finally input the second data. For example, input formula: 2 + 6
4. When the input operation is wrong, prompt "operator error!" should be given, and re-enter
(b) Tips:
When the user finally chooses whether to continue the next operation, it is decided by the user entering the character y or n. if you want to continue the operation regardless of whether the user enters the uppercase or lowercase character y, and enter the uppercase or lowercase character n, the program can exit. In this case, you can use the function tower or function toupper
Its function prototype is
Function prototype: int tower (int CH);
Function function: convert ch character to lowercase letter
Function return: return the lowercase letter of the character represented by ch
Function prototype: int to upper (int CH);
Function function: convert ch character to uppercase
Function returns: the capital letter corresponding to Ch
Since these functions are used in programming, add the following instructions to the precompiled line:
# include
(c) Test data:
First input: (underline is the input content, the same below)
Enter the first number: 5
Please select the operator (+, -, *, /): 9
Output: wrong operator!
Second input:
Enter the first number: 5.3
Please select the operator (+, -, *, /):+
Enter the second number: 7.9
Output: the calculation result is: 13.2
Do you want to continue? (Y / N): (please enter the character 'y' or 'n' to select)
Third input:
Enter the first number: 5.3
Please select the operator (+, -, *, /): -
Enter the second number: 7.9
Output: the calculated result is - 2.6
Do you want to continue? (Y / N): (please enter the character 'y' or 'n' to select)
The fourth input:
Enter the first number: 5.3
Please select the operator (+, -, *, /):*
Enter the second number: 7.9
Output: the calculated result is: 41.87
Do you want to continue? (Y / N): (please enter the character 'y' or 'n' to select)
The fifth input:
Enter the first number: 5.3
Please select the operator (+, -, *, /): /
Enter the second number: 7.9
Output: the calculation result is 0.670886
Do you want to continue? (Y / N): (please enter)