Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,459 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,821 people online right now. Registration is fast and FREE... Join Now!




calculator assignment

 
Reply to this topicStart new topic

calculator assignment

SNOOPLE
26 Jul, 2008 - 06:03 PM
Post #1

New D.I.C Head
*

Joined: 26 Jul, 2008
Posts: 7

Anyways im in Year 11 software class
and i got an assignment on making a calculator
right now i cant seem to get my sin cos tan working
for sin i wrote "math.sin but i dont really know what to do after.
Thanks in advanced

*and if this isnt enough info tell me what to add in. ty*

User is offlineProfile CardPM
+Quote Post

jacobjordan
RE: Calculator Assignment
26 Jul, 2008 - 09:10 PM
Post #2

class Me : Perfection
Group Icon

Joined: 11 Jun, 2008
Posts: 1,163



Thanked: 32 times
Dream Kudos: 1625
My Contributions
Well, it probably isn't enough for us to really help you. You don't really say what your problem is clearly:
QUOTE

for sin i wrote "math.sin but i dont really know what to do after.

What do you mean "dont really know what to do after"? To calculate the sin of a number, simply do:
vb

' "SomeNumber" will be assigned the result
' "NumberToSine" is the number you want to take the sine of
SomeNumber = Math.Sin(NumberToSine)

Same with cosine and tangent, and almost any other function in Math.

Also, i think you might find this tutorial useful. It's in VB.NET, but it shouldn't be that hard to translate.
User is offlineProfile CardPM
+Quote Post

SNOOPLE
RE: Calculator Assignment
26 Jul, 2008 - 11:58 PM
Post #3

New D.I.C Head
*

Joined: 26 Jul, 2008
Posts: 7

hmm well
i have a button on my calculator for sin cos and tan
and i have all the things that a normal standard calculator would have.
how do i make the right value come up when i type
sin(whatever number i type) =" in the calculator itself
and i want the answer to appear in textbox1....dont care if its in radience or anything yet.

yea im trying to find a code for that and if you can it'll be good if you can help me tell where to put it exactly

ty





User is offlineProfile CardPM
+Quote Post

jacobjordan
RE: Calculator Assignment
27 Jul, 2008 - 11:27 AM
Post #4

class Me : Perfection
Group Icon

Joined: 11 Jun, 2008
Posts: 1,163



Thanked: 32 times
Dream Kudos: 1625
My Contributions
QUOTE(SNOOPLE @ 27 Jul, 2008 - 02:58 AM) *

hmm well
i have a button on my calculator for sin cos and tan
and i have all the things that a normal standard calculator would have.
how do i make the right value come up when i type
sin(whatever number i type) =" in the calculator itself
and i want the answer to appear in textbox1....dont care if its in radience or anything yet.

yea im trying to find a code for that and if you can it'll be good if you can help me tell where to put it exactly

ty

Well, you don't really say what you want clearly at all. If all your asking is how to display the result of the sin in the text box, just type
vb

textbox1.Text = Math.Sin(whatever number i type)

User is offlineProfile CardPM
+Quote Post

SNOOPLE
RE: Calculator Assignment
27 Jul, 2008 - 05:19 PM
Post #5

New D.I.C Head
*

Joined: 26 Jul, 2008
Posts: 7

textbox1.Text = Math.Sin(whatever number i type)

hmm about that.
is there anything i have to type before that

On the calculator i want to click *Sin(anynumber) then press equals
and come up with the right answer

also if im not giving enough info can you tell me what i need to add in
User is offlineProfile CardPM
+Quote Post

jacobjordan
RE: Calculator Assignment
28 Jul, 2008 - 03:47 PM
Post #6

class Me : Perfection
Group Icon

Joined: 11 Jun, 2008
Posts: 1,163



Thanked: 32 times
Dream Kudos: 1625
My Contributions
Well, your problem is still very unclear. BTW, sorry about not being here very fast, i was having internet trouble. Anyway, to have a button that when clicked will display the sine of a number in a text box, simply add a click event for that button and put the code i wrote in my last post in it.
QUOTE

is there anything i have to type before that

that depends heavily on what you are doing. All that line will do is display the result of a sine calculation in a textbox. It would be very helpful if you actually include your code with the IPB Image tags. Also, try to be more specific when you state your problem.
User is offlineProfile CardPM
+Quote Post

SNOOPLE
RE: Calculator Assignment
29 Jul, 2008 - 02:09 AM
Post #7

New D.I.C Head
*

Joined: 26 Jul, 2008
Posts: 7

ahh i got sin cos tan thanks
but now i need to do the inverse sad.gif
is there a basic code for that?
User is offlineProfile CardPM
+Quote Post

jacobjordan
RE: Calculator Assignment
29 Jul, 2008 - 09:35 AM
Post #8

class Me : Perfection
Group Icon

Joined: 11 Jun, 2008
Posts: 1,163



Thanked: 32 times
Dream Kudos: 1625
My Contributions
There is no direct function to take the inverse of a number. However, all the inverse is is 1 divided by a number, so it can easily be done with this
CODE

1 / (The number you want to take the inverse of)

That will return the inverse of that number.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 03:56PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month