program to create a functional calculator in visual basic
Answers
Answered by
7
For the Sin button, enter the following code:
Private Sub CmdSin_Click()
sinx = Round(Sin(displayValue * 4 * Atn(1) / 180), 4)
panel.Caption = sinx
End Sub
* The Round function is to correct the output to certain number of decimal places.
For the Cos button, enter the following code:
Private Sub CmdCos_Click()
cosx = Round(Cos(displayValue * 4 * Atn(1) / 180), 4)
panel.Caption = cosx
End Sub
For the Tan button, enter the following code:
Private Sub CmdTan_Click()
tanx = Round(Tan(displayValue * 4 * Atn(1) / 180), 4)
panel.Caption = tanx
End Sub
For the Ln button, enter the following code:
Private Sub CmdLn_Click()
panel.Caption = Log(displayValue)
End Sub
and for the Log button, enter the following code:
Private Sub CmdLog_Click()
panel.Caption = Log(displayValue) / Log(10)
End Sub
Private Sub CmdSin_Click()
sinx = Round(Sin(displayValue * 4 * Atn(1) / 180), 4)
panel.Caption = sinx
End Sub
* The Round function is to correct the output to certain number of decimal places.
For the Cos button, enter the following code:
Private Sub CmdCos_Click()
cosx = Round(Cos(displayValue * 4 * Atn(1) / 180), 4)
panel.Caption = cosx
End Sub
For the Tan button, enter the following code:
Private Sub CmdTan_Click()
tanx = Round(Tan(displayValue * 4 * Atn(1) / 180), 4)
panel.Caption = tanx
End Sub
For the Ln button, enter the following code:
Private Sub CmdLn_Click()
panel.Caption = Log(displayValue)
End Sub
and for the Log button, enter the following code:
Private Sub CmdLog_Click()
panel.Caption = Log(displayValue) / Log(10)
End Sub
Attachments:
Similar questions