Integer division is SO useful. I can't believe I made the Arabic to Roman numerals converter using that. The program is even able to write numbers from 0 to 3000 (instead of 1000 to 3000) which is amazing! I can't believe I'm so excited for something that silly, haha!
By the way, just a reminder to myself: Integer division and modular arithmetic are NOT the same.
I need to get that into my head...
Friday, March 23, 2012
Thursday, March 22, 2012
Ugh... stupid "break;" >.>
Programming is frustrating... a little bit. I spent like 10 minutes looking for a really small error I couldn't get to find by myself, until I used a debugger to get to it. I just missed a "break;" inside my switch statement and my string variables went crazy changing.
Note to self:
Write more carefully. It's better to take my time writing the program, than to write it as fast as I can and, later, lose a bunch of time looking for mistakes.
Update:
UGH! Found another one. I can't believe this. Next time I'm seriously going to take my time and my patience to write one.
Note to self:
Write more carefully. It's better to take my time writing the program, than to write it as fast as I can and, later, lose a bunch of time looking for mistakes.
Update:
UGH! Found another one. I can't believe this. Next time I'm seriously going to take my time and my patience to write one.
Saturday, March 17, 2012
What sorcery is this!? Computers can divide by zero!
I can't believe it! Including the directive <cmath> to my source code actually allows the computer to calculate infinite values. I had a small error with the Leibniz's Pi approximation series where I ended up basically dividing 1 by zero and multiplying that by 4, but this is what I got:
There's no floating point exception!
Please enter the number of terms you would
like to sum from the Leibniz's Pi approximation series: 0
The sum of the 0 term(s) results in
the Pi approximation equal to: inf.
There's no floating point exception!
Tuesday, March 13, 2012
632 lines of code!
I thought my head was going to explode! This program was huge! Most of it copy paste though... it repeated a lot, but it took me some time to see the pattern. I can't leave this for the last week. I got to work on Lab 3 during the weekend. Programming in C++ seemed easier to write than what it actually is. Silly things that help like indenting and formatting stuff with variables and such help so much but it takes so much time. I still like to write C++ code though, but this program seriously took some of my time.
... I want a Raspberry Pi. =|
Thursday, March 8, 2012
I never thought I'd say this...
... but, I think I'm starting to like programming a LOT. I mean, my grade wasn't what I really wanted on my first midterm. I don't blame myself though, I had a lot of stuff to do that week, and my reading-code skills aren't that great right now, but is just that whenever I try to solve a problem by writing a program, and the more I do it, the clearer my thoughts become. These are the kinds of problem I love doing. And, on top of that, this is really practical stuff. I'm pretty sure that the time will come when I can translate everything that I know so far of math to C++. And what's good about it is that I can use it to solve some complex stuff for some people by asking just a little bit of input that I know they can give. Gosh, the more I think about it, the more I like to write code. :|
I got to stop thinking now though, I have to sleep.
I got to stop thinking now though, I have to sleep.
Subscribe to:
Posts (Atom)