Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,261 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Snippets: Arabic to Roman numbers conversion #57482
10/10/05 21:26
10/10/05 21:26
Joined: Aug 2005
Posts: 1,185
Ukraine
Lion_Ts Offline OP
Serious User
Lion_Ts  Offline OP
Serious User

Joined: Aug 2005
Posts: 1,185
Ukraine
In 'dark places' of my HDD there are archives with names like 'sources...'.
I just started to clean it, so I'll post code snippets (after translating to C-script) if I'll find usefull one.
At first:
Code:

string RomanString;
string* RomanToIntStrPtr;
var vals[13]= (1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000);
text roms{
strings=13;
string="I", "IV", "V", "IX", "X", "XL", "L", "XC", "C", "CD", "D", "CM", "M";
}
function IntToRoman(num){ //returns num in capital roman digits
var b=12;

str_cpy(RomanString, "");
while (num > 0) {
while (vals[b] > num) {
b-=1;
}
num-=vals[b];
str_cat(RomanString, roms.string[b]);
}
}


example usage:
Code:

...
IntToRoman(20);
str_cat(RomanString, " century Fox");
...



Re: Snippets: Arabic to Roman numbers conversion [Re: Lion_Ts] #57483
10/11/05 18:17
10/11/05 18:17
Joined: Jul 2004
Posts: 1,924
Finland
Ambassador Offline
Serious User
Ambassador  Offline
Serious User

Joined: Jul 2004
Posts: 1,924
Finland
hmmm.... truly... truly interesting... very nice indeed... hmm...


Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1