I came across a problem where I wanted to grab some data off a CSV text file (see sample below) and plug it into a data structure, but — and there’s always a “but” — I had to do it in ANSI C. Eyeroll. Doing it in Python would be a snap:
1
2
3
4
5
6
7
8
9
10
path = "players.txt"
dbfile = [...]
By Jorge Cosgayon
|
Posted in Code
|
Tagged c, data structures, programming, python, struct
|
Mon Sep 2009
I wanted to try my hand at sorting, this time, because it’s something I never got around to doing in the past. So I quickly whipped up around ten thousand random integers, put it in a text file, and went to work. My first idea was to do a bubble sort, but the idea of [...]
By Jorge Cosgayon
|
Posted in Code
|
Tagged c, ict, programming, sort
|
Sun Feb 2009
Again, just practicing; this time, on how to determine whether a given number is prime or not. This was actually the first C problem I ever encountered waaay back in the day; I remember failing. Miserably. Anyway, a refresher: in mathematics, a prime number (or a prime) is a natural number which has exactly two [...]
By Jorge Cosgayon
|
Posted in Code
|
Tagged c, ict, primes, programming
|
Sat Feb 2009
PHP I can do just fine; and I’m still in awe of the possibilities with Python (I always end up thinking: whoa… you can do that in Python?! Is this a noob thing? Because so many things are just darn easy in Python!). But I haven’t even looked sideways at any C code since 1997, never got over my fear of Java, and the last version of Visual Basic I used was VB4. Oh, and I don’t even know what COBOL code looks like. So yeah, SOL.
By Jorge Cosgayon
|
Posted in Code
|
Tagged c, ict, programming, python
|
Fri Feb 2009