c++ - How to divide a string into parts - Roman numerals -
I am trying to divide a string into parts to read Roman numerals. For example, if the user enters
"XI"
I have to understand the program that I am 1 and 10 in order of 10 Such a data verification for
if (string roman == "X") int roman + = 10; e.t.c.
To access the character of a person from a string, use square brackets Do:
Integer number = 0; Four R = Roman [0]; If (R == 'X') {num + = 10; }
There is no one complete example above, but you must be sufficient to begin. This example looks like the first letter of the character in the string Roman
(letters are started on the left with numbered index 0). Checks to see if the character is 'X'
, and if so, then 10 num
increases the variable by 10.
Comments
Post a Comment