Skip to main content
GameDev.net gamedev.net
🔒 Locked

Ada Help Needed

Started by cbratton Mar 22, 2004 at 6:20 PM 1 replies 500+ views
Original Post
cbratton
cbratton
Looking at the example code, I''m trying to make a few changes and have no clue how to do it. Basicaly, this is a CLI (Command Line Interface) Calculator. You punch in an equation and it spits out an answer. I''m trying to get it to store calculations as well as print them out in numerical order according to their result, like so:
2
+
1=
1+1+2=
4 * 4=
^D
2 + 1 = 3
1 + 1 + 2 = 4
4 * 4 = 16
 
Answers aren''t printed out until ^D (EOF) has been reached. I''m just having problems doing those last few things with the code I have. Any help is appreciated. Download example source: http://forums.extremeoverclocking.com/attachment.php?attachmentid=32848
cbratton
cbratton
I should also mention that support for multiple equations is needed...currently the program is only printing out the answer to one. Also, it is not requiring an equal symbol at the end of an equation but it needs to...

ie, if I run it now:
input:
5 + 5
output:
10

What I''m trying to do:
input:
5 + 5 =
1 + 4 =
7 * 2 =
output:
1 + 4 = 5
5 + 5 = 10
7 * 2 = 14
Kylotan
Kylotan
You''re gonna have to add each equation to some sort of list as you go along. Then sort it by the answer at the end before you output it. As for requiring an equals symbol, well, that''s a lot of files in that zip, and in a language most of us won''t understand. It might help if you were able to post the specific part that handles the input.

[ MSVC Fixes | STL Docs | SDL | Game AI | Sockets | C++ Faq Lite | Boost
Asking Questions | Organising code files | My stuff | Tiny XML | STLPort]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.