TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JAMES NORMAN
from: CAMERON CLARK
date: 1997-09-01 02:02:00
subject: Re: Roman Numeral???

JN> Hi there :) was wondering if anybody have any ideas or C++ libraries, 
hat
JN> deal with roman numerals?? 
    Sounds like a homework assignment (that I had in the nineth grade).
    For int -> roman
         largest_count  = sum % "largest roman numeral";
         sum = sum % "lrn";
         second_largest = sum % "second largest numeral";
         sum = sum %  "sln";
         ...
         smallest = sum % "smallest numeral";
         sum = sum % "sn";
         
         so if the largest to smallest stream of roman
         numerals looked like "1000,500,100,10,5,1"
         M = sum % 1000; sum = sum % 1000;
         C = sum % 500;  sum = sum % 500;
         L = sum % 100;  sum = sum % 100;
         X = sum % 10;   sum = sum % 10;
         V = sum % 5;    sum = sum % 5;
         I = sum % 1;    sum = sum % 1;
         (These are not the correct roman numerals!)
         The only trick is displaying numbers 4,6,7,8,9
         (iv, vi, vii, viii, viii)
         After getting the mod of 10, you should just use the
         following
         char*last[]={"","I","II","III","IV","V","VI","VII","VIII","VIIII"};
         to print the last sequence.
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.