![]() Shoutbox (View Full Shoutbox)
|
||||
Click Refresh to load shouts. |
||||
|
Calculator
|
|
04-29-2008, 04:53 AM
(This post was last modified: 05-04-2008 02:49 PM by Martijn. Edit Reason: )
Post: #1
|
|||
|
|||
|
Calculator
Hello, thanks for reading.
I am currently new to programming, and I am interested in C++. I finished a calculator a few days back, and jesper convinced me to post it here so you guys could comment it, and tell me what to improve. Don't be to harsh on me please! ![]() A screenshot. ![]() (The idea is, you need to pick your option for what you want to do, and then say the first number you want to for example multiply and the second number it will give the outcome, and repeat the menu (I don't know why it does that, can't seem to fix it) The code itself (It's called source I believe) Code: // Created by Martijn for learning purpose.- English Version - (Y/N) function after calculating - Custom title (not C://~ anymore) Todo: - Think of a cool name! - GUI - Known Bugs: - - Thanks to ufo for the correct translation. Thanks for reading, and I'd would be great if you would tell me what you think about it, maybe a suggestion. The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.
|
|||
|
04-29-2008, 05:12 AM
Post: #2
|
|||
|
|||
|
Calculator
Code: int main()Code: [color=red]}[/color]This causes the calculator to loop all the time. For(;; ) will basically run until smth tells the program to stop. If you cut those out it should work once and then close
Quote:GOD is a DJ |
|||
|
04-29-2008, 05:16 AM
Post: #3
|
|||
|
|||
|
Calculator
Suggestion - Make GUI for it, then also make it in english : D
![]() |
|||
|
04-29-2008, 05:28 AM
Post: #4
|
|||
|
|||
|
Calculator
That ending thing.. You should create something like that
Code: bool Closing = false;So change your for( ; ; ) to something like that
TibiaAPI Developer |
|||
|
04-29-2008, 05:28 AM
(This post was last modified: 04-29-2008 05:42 AM by Martijn. Edit Reason: )
Post: #5
|
|||
|
|||
|
Calculator
Thanks for the responses both!
Really appreciate it. Ufo, when I simply remove the lines you mentioned, it gives a error. 'break statement not within loop or switch' in line 22. Code: if (choice == 'q') break;I thought that one was for when you press Q it closes. but when I removed it, it worked, and so did the "Q" function, what is that line for then? Also, It doesn't repeat the menu any more, but closes the program before you can even read the outcome, but I'll play around with that. (that system pause or something could work.) Jesper ![]() A gui is a graphical user interface, right? Never done it before, but I'll try to find some good tutorials on it. Thanks! (And yes, I'll do a english version.) Also, if this is in the wrong section, I am terribly sorry. Edit: Another responce! Thanks OsQu! I'll play around with it, and will update my post, thanks! Edit2: Haha, I can't seem to let that script work, it gives me only bugs ^^. You guys really give me a big smile IRL. The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.
|
|||
|
04-29-2008, 05:29 AM
Post: #6
|
|||
|
|||
|
Calculator
I think OsQu or someone can move it to Open Source
![]() |
|||
|
04-29-2008, 05:34 AM
Post: #7
|
|||
|
|||
|
Calculator
Code: if (choice == 'q')![]() It's meant to quit the for(;; ) loop. Note it's case sensitive... Quote:GOD is a DJ |
|||
|
04-29-2008, 05:47 AM
Post: #8
|
|||
|
|||
|
Calculator
I've managed to stop to let it repeat the menu with using, 'system ("pause");
But the thing is, it says "Press a key to continue" but the "q" function doesn't work then. So you first press 'q' and it continues, it opens the menu again, and then you need to press 'q' again to quit it. Can I use something like a 'if else' statement? Code: system ("pause"); The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.
|
|||
|
04-29-2008, 06:20 AM
Post: #9
|
|||
|
|||
|
Calculator
I don't think so...
Try moving the `if (choice == 'q')` to the beggining of FOR loop. So it would look smth like this Code: for(;;) {Quote:GOD is a DJ |
|||
|
04-29-2008, 07:07 AM
(This post was last modified: 05-01-2008 08:21 AM by Martijn. Edit Reason: )
Post: #10
|
|||
|
|||
Calculator
ufo Wrote:I don't think so... That didn't work, still the same. I've translated it in english now, and looking for some good GUI tutorials atm, but can't find any. Edit: Added a (Y/N) function, works great. Added a custom title, found that script somewhere ^^. Also a new image. The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.
|
|||
|
« Next Oldest | Next Newest »
|

![[-]](images/mint/collapse.gif)


![[Image: rekenmachiners9.png]](http://img329.imageshack.us/img329/1451/rekenmachiners9.png)



![[Image: buttonug.png]](http://www.tibiaug.com/buttonug.png)