.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old February 4th, 2004, 06:45 PM
loneferret loneferret is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 loneferret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Need help with VB.Net fast! :)

Hey there... new at VB.Net and I got to do a calculator that takes in consideration the operation priority
ex.: 2+3*4=14 not 20 like the calculator offered in Windows.
It's probably easy for some of you out there, and I normally wouldn't aks but... I'm in a bind. Could someone help me out here please?

Thanks

LoneFerret

Reply With Quote
  #2  
Old February 5th, 2004, 12:25 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Posts: 2,056 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
I believe you can only enter in one sum at a time in the MS calc.exe - hence op priority not working.

Reply With Quote
  #3  
Old February 5th, 2004, 04:16 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
sounds like loneferret wants to make a whole new calculator program...
and it has to incorporate BEDMAS i take it?

have you got any logic worked out already?
perhaps even some code?

Reply With Quote
  #4  
Old February 5th, 2004, 05:13 PM
loneferret loneferret is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 loneferret User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by MadCowDzz
have you got any logic worked out already?
perhaps even some code?


Hello there... I've allready started yes. Image you type in a normal textbox 22+33*86 , I split it and add-it to an arraylist. So the index(0) would be 22, index(1) is + and index(2) is 33 and soforth. So basically what i need to do is multiply 33 and 86 before adding 22. If there was a division, well the division would be done also before the addition... I have no problems doing this, it's the actual operations that I can't get to work, for some reason I can't do it. If I'm in left feild here someone tell me?

Thx.

LoneFerret

Reply With Quote
  #5  
Old February 17th, 2004, 12:43 AM
yulyos yulyos is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 6 yulyos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 33 sec
Reputation Power: 0
Hi,

Dim total As Double
total = (22 + 33) * 86
TextBox1.Text = total

' The result is 4730

Have a nice day

Reply With Quote
  #6  
Old February 20th, 2004, 09:52 PM
michigandude michigandude is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 michigandude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool possible solution !!! not sure though

Hi there,
I guess the way you are trying to equate it is incorrect. VB.net compiler does understand operator precedence, but the way you are doing it is probably incorrect. When the eqn : 22 + 33 * 86 is compiled, a stack is made where the last two operations occur.
The stack looks something like this

+22
33
*86

Hence you will have to reverse the way you are giving them indexes 0, 1 and 2.
I think you should have a fair idea.

Yet again : These are just muh few cents. Hope they help you.

Peace.........


Quote:
Originally Posted by loneferret
Hello there... I've allready started yes. Image you type in a normal textbox 22+33*86 , I split it and add-it to an arraylist. So the index(0) would be 22, index(1) is + and index(2) is 33 and soforth. So basically what i need to do is multiply 33 and 86 before adding 22. If there was a division, well the division would be done also before the addition... I have no problems doing this, it's the actual operations that I can't get to work, for some reason I can't do it. If I'm in left feild here someone tell me?

Thx.

LoneFerret

Reply With Quote
  #7  
Old February 20th, 2004, 11:55 PM
yulyos yulyos is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 6 yulyos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 19 m 33 sec
Reputation Power: 0
Reply to: possible solution !!! not sure though

Hi,

To: michigandude

What is incorrect?
The result or the way I get the result.

However, if the result is correct, so the way is correct

The bottom line is what you get.

Have a nice day

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Need help with VB.Net fast! :)


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap