PDA

View Full Version : calculator that show its operation



naem
3rd April 2014, 23:21
hi !
im making a calculator uising qtcreator . and its suppose to show its operation in the first lineEdit .

for example , when i click on num 2, then on '+' button, and lastly the num 3, the first lineEdit should be '2+3'. when i click on '=' button , the answer should
appear in second lineEdit ..

can anyone help me with the coding ? for example -> 10249

stampede
4th April 2014, 00:14
You need to parse the infix expression, simple way is to convert it to reverse-polish notation (Shunting-yard algorithm (https://en.wikipedia.org/wiki/Shunting-yard_algorithm)) and then use stack to calculate the result.