I am new to programming, so no flames please. Can something like this be ported to Perl? (I am trying to learn it.)
Yes, this can be ported to perl. Anything in C can be written in perl (and vice versa).
C is weakly typed, so I'm not sure what you're getting at here... Strong typing is to save the programmer from himself. I personally do not enjoy programming in languages that remove C's power to make non-sensical casts.
So, I guess what I am really asking is: Is this kind of program only able to be written well in something like C++ or Java?
Absolutely not. This is just an algorithm for calculating Pi. C is nice because it's portable and fast. Check out a functional programming language like Haskell. Selecting a programming language for a particular task involves clearly stating your goals. If I wanted to confuse you, I'd write it in Malbolge or BrainF*ck. If I wanted to calcuate pi quickly (millions of digits), I might write it in C, but I'd also do my homework. If I wanted something from the command line, I'd use:
(Besides that I have a feeling that using an object-oriented language (like Visual C++) would reduce the amount of code you would have to write (due to increased code re-use.))
Simple algorithms like this one are fairly atomic. You're foo class isn't going to help you here. You really aren't going to resuse this either. That's what M_PI is for =).
You're confusing "game objective" with "game experience".
I am new to programming, so no flames please. Can something like this be ported to Perl? (I am trying to learn it.)
Yes, this can be ported to perl. Anything in C can be written in perl (and vice versa).
C is weakly typed, so I'm not sure what you're getting at here... Strong typing is to save the programmer from himself. I personally do not enjoy programming in languages that remove C's power to make non-sensical casts.
So, I guess what I am really asking is: Is this kind of program only able to be written well in something like C++ or Java?
Absolutely not. This is just an algorithm for calculating Pi. C is nice because it's portable and fast. Check out a functional programming language like Haskell. Selecting a programming language for a particular task involves clearly stating your goals. If I wanted to confuse you, I'd write it in Malbolge or BrainF*ck. If I wanted to calcuate pi quickly (millions of digits), I might write it in C, but I'd also do my homework. If I wanted something from the command line, I'd use:
$perl -e 'for(0..9999){$i=$_*8;$p+=(16**-$_)*(4/($i+1)-2/($ i+4)-1/($i+5)-1/($i+6))}print$p'
It's really a matter of "what gets the job done."
(Besides that I have a feeling that using an object-oriented language (like Visual C++) would reduce the amount of code you would have to write (due to increased code re-use.))
Simple algorithms like this one are fairly atomic. You're foo class isn't going to help you here. You really aren't going to resuse this either. That's what M_PI is for =).
Contact: 1997 (via imdb.com)h tml)
Enlightenment (old) FAQ: copyright 1997 (via http://www.enlightenment.org/documentation/faq-1.