| | |
need help with calculator program in C
![]() |
•
•
Join Date: Jan 2005
Posts: 1
Reputation:
Solved Threads: 0
i need help on how to make a calculator program on C.
for example:
100+3*(344-45)-3/20= ?
ive done a part of it, but it doesnt even give the right answer. the user inputs anything (excluding letters and some puncts). it accepts the equation as a string. ive already converted the string into integers using atoi() fn but im stucked and i dont know what to do next. i made a program similar to this but it doesnt follow the precedence of the operators and it cant compute the answer when you include parenthesis on it...
I need help badly! thanks....
*anything from telling me what to do next will do or any other will do* ill just try to analyze all your answers and see if i can really get it... :lol:
for example:
100+3*(344-45)-3/20= ?
ive done a part of it, but it doesnt even give the right answer. the user inputs anything (excluding letters and some puncts). it accepts the equation as a string. ive already converted the string into integers using atoi() fn but im stucked and i dont know what to do next. i made a program similar to this but it doesnt follow the precedence of the operators and it cant compute the answer when you include parenthesis on it...
I need help badly! thanks....
*anything from telling me what to do next will do or any other will do* ill just try to analyze all your answers and see if i can really get it... :lol:
Oddly enough, I answered this very question on another forum yesterday. The trick is to convert the expression to postfix so that you can easily evaluate it with a stack based approach. Alternatively, you could build an expression parse tree, but that just adds extra unnecessary steps in most cases.
I'm here to prove you wrong.
Please read the Announcement.
Though I can't specifically say that you're doing a homework problem, the signs are there. We don't do work for you. Please post some code, and we'll help you troubleshoot.
Though I can't specifically say that you're doing a homework problem, the signs are there. We don't do work for you. Please post some code, and we'll help you troubleshoot.
Alex Cavnar, aka alc6379
![]() |
Similar Threads
- 40 digit accuracy calculator program (C)
- Write a calculator program using a do-while loop (C++)
- java calculator program (Java)
- Really need help with the interactive Calculator program, or will be dead (C++)
- starting a calculator program in C (C)
- Java Swing Calculator program not running. It has 0 errors (Java)
- Wierd error messages with calculator program (C++)
Other Threads in the C Forum
- Previous Thread: bubble sorting in an array
- Next Thread: Bits, Part 1
| Thread Tools | Search this Thread |
adobe api array arrays binarysearch calculate char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators intmain() iso kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat opensource openwebfoundation owf pattern pdf performance pointer posix power probleminc program programming pyramidusingturboccodes read recursion recv recvblocked repetition research scanf scheduling segmentationfault send shape socketprograming socketprogramming stack standard strchr string suggestions systemcall test unix urboc user variable voidmain() wab win32api windows.h






