The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > General Programming > C / C++


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Tags:

Closed Thread
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 06-10-2007, 04:00 PM
bahare m
Posts: n/a
[SOLVED] thew compelete program of calculator in c++ language?

the engineering calculator

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #2 (permalink)  
Old 06-10-2007, 04:00 PM
aleximas
Posts: n/a
i did that project!
EXPLINATION! operands=1, 2, 3 , etc
operators=+ - / *
you need to use inverse polish notation for an equation cause that is how the computer does it. now you also need to have a sort of priority so that when you itterate the stack in which you store your operators you know what to do (mainly using cases).
so let's say you have something like 1+2+3*5/3. the first thing is that you say * and / are higher priority than + and -. so if 2 of the same operators come in the stack one after another you make the calculation with the operator which already was on the stack of operators betwen the last 2 operands and if a lower level operator comes on the stack of operators you do the previous operation on the operators stack after which you put on the operatros tasck the lower class operator that came! you need 2 stacks one for operators and one for operands. so let's see how taht would look like.
1+2+3*5/3
you read 1 and put it on the operands stack. you read plus you put it in the operator class. you read 2 you put it on the operand stack. you read plus....but the last element on the stack of operands is a + too (SAME CLASS OPERATOR) so what you do is make a plus operation (the 1st element in the operator stack which already was on the stack)of the last elements on the operands stack (last-1) and last and put the result on the operand stack and on the operator stack you only have a plus left the 2n plus that come in the equation.
you read 3 you put it on the operands stack. you read * and since it is higher priority you put it on the operand stack and don't do anything yet. you read 5 and put it on the operand stack and then you read / but you already have a *(SAME CLASS OPERATORS). so what you do is to do the * between the last two elements put on the operand stack and push the result on the operand stack. you read 3 and push it on the operand stack and now you are done with iterating the equation so what you do is do all the operations on the operator stack by taking the last 2 terms of the operand stack and pushing the result of the operation on the operands stack. when you finish itterating the operator stack all you ahve left is the final result in the operands stack.
i hope it helps!
if you need more help please say so by adding additional info to your question text.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #3 (permalink)  
Old 06-10-2007, 04:00 PM
Doogie Howser
Posts: n/a
e=M Geek squared!

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #4 (permalink)  
Old 06-10-2007, 04:00 PM
Charley M
Posts: n/a
I quote "GraphCalc has decided to release the sourcecode to the Windows version of GraphCalc 4.0alpha under the GNU General Public License (GPL)."

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
  #5 (permalink)  
Old 06-10-2007, 04:00 PM
doug_donaghue
Posts: n/a
Probably. That seems to be what everyone is writing in these days.

Doug

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Closed Thread


Thread Tools
Display Modes

   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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 01:19 PM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


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