VaultNetwork.net Vault Network Boards
Author Topic: how hard would this be to program? [Locked]
Eradiani  3 stars
Title: Moderator/ EvEVault Staff
AE mid to deep

Posts: 527
Registered: 2002-5-3 02:18:49
Koneg posted:

Eradiani posted:

LOL I'm sure they are looking for someone to make it themselves.. not pass it to a pre-made function

**scratches head**

I would bet real money this function/library exists for every programming language you care to name, but hey... Have fun re-inventing that wheel if it really makes you happy.

Well the way it was asked made it sound like it was a lab for a programming course in college (or at the very least you had to assume that there wasn't something out there that already did this). so yeah you sort of have to re-invent the wheel for that sort of thing

 

-----signature-----
GrymmDAOC  1 star
Posts: 241
Registered: 2001-12-6 13:04:16
Now write it in Intercal!

 

-----signature-----
Now speccing 2h sword IRL.
Aerlinthian  4 stars
Posts: 2,126
Registered: 2001-5-7 23:53:38
I thought real programers wrote in assembly.


Scarne  4 stars
Title: Capo di Scientifico
Posts: 1,087
Registered: 2001-7-23 15:24:34
It's easy since there are some basic patterns.

First, groups the digits of the number into the groups of three as we do with commas when writing the number out. Each group of the is written as "{blah-blah-blah} {billion|million|thousand|[nothing]|etc}" with a separator between groups. This lets you write out numbers as big as you have the names of the groups for.

For the groups of three digits themselves, they break down into "{blah} hundred {blah-blah}". So the hundreds digit is taken care of. Then you just need to do all the special case logic to write out the tens and ones digit for the group.

There are a few other special cases to suss out like skipping groups of "000", but it shouldn't be too bad.

 

-----signature-----
E Pluribus Unum
RHWarrior  3 stars
Posts: 770
Registered: 2009-9-30 18:42:12
I used to be a Perl programmer, then I took a Python to the knee!

 

-----signature-----
"Drink coffee - do stupids things faster with more energy! ...and I'm all out of beans..." -me
"ou guys need to stop dick riding wow and compare everything to it. It never invented a godamn thing, just made it popular. " -tinkly

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.