Thursday, November 18, 2010

Angka Romawi Converter

Tthis VB6 program converts an integer in the range of 1 through 3999 to its equivalent in Roman numerals. VB6 program to convert an integer in the range 1 to 3999 for the equivalent in Roman numerals. Also it converts a Roman numeral string to its decimal equivalent.

It is also changing the Roman numeral string to its decimal equivalent.

The rules for Roman numerals are as follows: The rules for Roman numerals is as follows:

* The basic symbols are I (= 1), V (= 5), X (= 10), L (= 50), C (= 100), D (= 500), and M (= 1000). Basic symbols are I (= 1), V (= 5), X (= 10), L (= 50), C (= 100), D (= 500), and M (= 1000).
* If a letter is Immediately followed by one of equal or lesser value, the two numbers are added, thus, XX = 20, XV = 15, VI = 6. If the letter is immediately followed by one or more of the same low value, two numbers are added, thus, XX = 20, XV = 15, VI = 6.
* If a letter is Immediately followed by one of Greater value, the first is subtracted from the second, thus IV = 4, XL = 40, CM = 900. If the letter is immediately followed by one of greater value, the first is subtracted from the second, so IV = 4, XL = 40, CM = 900.
* A bar over a letter multiplies it by 1000; thus, an X with a bar over it = 10,000. A bar over a letter multiplies it by 1000, thus, X with a bar above = 10,000. Such numbers will of not be addressed by this project. these numbers will not be addressed by this project.

Examples: The numbers from 1 to 10 acres: I, II, III, IV, V, VI, VII, VIII, IX, X. The numbers from 1 to 10 are: I, II, III, IV, V, VI, VII, VIII, IX, X.

XLVII = 47, CXVI = 116, MCXX = 1120, MCMXIV = 1914. XLVII = 47, CXVI 116, MCXX = = 1120, MCMXIV = 1914.

Note That a given symbol appears no more Than three times consecutively in a number. This is why 4 is written as "IV" instead of "IIII", and 40 is written as "XL" instead of "XXXX". Note that a given symbol appears no more than three times in a row in numbers. This is why 4 is written as "IV" instead of "IIII", and 40 listed as "XL" instead of "XXXX".

Probably the most challenging part of converting a Roman numerals to decimal numbers is not the conversion itself, but rather validating the input. Perhaps the most challenging to convert Roman numerals to decimal numbers rather than the conversion itself, but to validate the input. Basic validation Would include converting keystroke input to uppercase and allowing only the characters I, V, X, L, C, D, and F to be ENTERED. basic validation will include input keystroke to convert uppercase and only allows the characters I, V, X, L, C, D, and F must be included. Beyond that, the Following Should Be rules applied: Beyond that, the following rules shall apply:

* D, L, or V-only EACH May Appear at most one time in the string D, L, or V may each only appear at most once in the string

* M, C, X, or I May Appear no more That three times consecutively in the string F, C, X, or I may appear no more that three times in a row in the string

* The Following pairs of letters are invalid in all cases: IL, IC, ID, IM, XD, XM, VX, VL, VC, VD, VM, LC, LD, LM, DM. The following pair of valid characters in all cases: IL, IC, ID, IM, XD, XM, VX, VL, VC, VD, VM, LC, LD, LM, DM.

* Once a letter has been subtracted from, neither it nor its "5 counterpart" May Appear again in the string - so neither X nor V cans follow-IX, neither C nor L May follow-XC, and neither M nor D May follow-CM. Once a letter has been subtracted from, nor is it or the company "5 peer" may appear again in the string - so no X or V can follow IX, both C and L to follow the XC, and no M or D may follow the CM.

* Once a letter has been Used as a modifier subtraction, it can not Appear again in the strings - so C can not follow the CD or CM, X can not follow XL or XC, and I can not follow IV or IX. Once the letter has been used as a modifier reduction, can not appear again in the string - so that C can not follow the CD or CM, X can not follow the XL or XC, and I can not follow IV or IX.

* Once I, X, or C (or Their "5-counterparts" V, L, and D) appears in a string, the I, X, or C can not subsequently be Used as modifiers subtraction - IV or IX so I can not follow or V, XL or XC can not follow the X or L, and the CD or the CM can not follow C or D. After I, X, or C (or their "5-co" V, L, and D) appears in a string, I, X, or C can not be later used as a modifier reduction - so IV or IX can not follow me or V, XL or XC can not follow the X or L, and CD or CM could not follow C or D.

Sample runs are shown below. Examples are as follows.

VB6  screen1

When the user selects "Roman Numerals to Decimal Number" for the conversion type, note that the captions change and the reverse conversion is performed: Ketika pengguna memilih "angka Romawi ke Desimal Nomor" untuk jenis konversi, perhatikan bahwa perubahan keterangan dan konversi sebaliknya dilakukan:

VB6  screen2

Example of invalid input: Contoh input tidak valid:

VB6  screen3

VB6  screen4



konversi romawi

konversi bilangan to terbilang

0 comments:

Post a Comment