Like Tree2Likes

how do i display a roman numerals from ordinary numbers??

This is a discussion on how do i display a roman numerals from ordinary numbers?? within the C++ Programming forums, part of the General Programming Boards category; Converting 9 is easy, because you only have to deal with one digit. A look up table does the trick. ...

  1. #31
    Registered User
    Join Date
    Apr 2006
    Posts
    2,053
    Converting 9 is easy, because you only have to deal with one digit. A look up table does the trick.

    A more instructive example is converting a number like 909. In this case you must first convert the 900, then deal with the remainder. So 909 is CM followed by the converted form of 9.
    Last edited by King Mir; 07-05-2011 at 08:39 PM.
    It is too clear and so it is hard to see.
    A dunce once searched for fire with a lighted lantern.
    Had he known what fire was,
    He could have cooked his rice much sooner.

  2. #32
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,761
    yes..i thought that your getting what i mean whiteflags??
    But the important thing is, are you getting what I mean? It doesn't matter if I understand it. You are the student here.

    then what kind of operators i will use..??
    From my example, we see the numbers getting smaller so you will have to subtract the value of the numerals you write down from the number you convert each time. Then you append the numeral to the string. If you don't know strings, you need to learn their basic usage before attempting this. You also need first grade math skills.
    when i write a algorithm flowchart and solution..can you give a example code??
    Sample code, for a problem like this, is as good as solution code. I will not give a working sample of this problem. After you get some work done, I will be happy to correct your work.

    when converting 9??i will use it as a guidelines..
    You need to save the digits answers in memory. Eventually you'll get to single digits and it will be the easiest thing to append to the answer.

  3. #33
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,761
    Quote Originally Posted by King Mir View Post
    A more instructive example is converting a number like 909. In this case you must first convert the 900, then deal with the remainder. So 909 is XC followed by the converted form of 9.
    Especially instructive since it's either CMIX, DCDIX, or DCCCCIX....

  4. #34
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,007
    How many times we must repeat this? First you make a flowchart! Forget all about coding! Forget all about headers, operators, if statements, switch cases, etc.
    Do we need an algorithm to write a flowchart? No.
    Can we deduce an algorithm from a flowchart? Yes.

    How does one write a flowchart, then? One starts doing the mental exercise by hand and writing down the steps one takes.
    If you cannot do that, then you are beyond help.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #35
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,267
    Quote Originally Posted by Elysia
    Do we need an algorithm to write a flowchart? No.
    I would say "yes", since a flowchart is a way to express an algorithm. You cannot express what you don't have. The point though is that a flowchart (or my preference: pseudocode) allows you to express an algorithm without caring about the specifics of programming language syntax or other nitty gritty details that you have to take care of to have a correct program.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #36
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,007
    Clearly arguable, but what I mean to say is that you don't need to know an algorithm beforehand to start writing a flowchart. A flowchart is best at making up an algorithm as you go.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #37
    Registered User
    Join Date
    Jul 2011
    Posts
    5
    Quote Originally Posted by Elysia View Post
    OK, so your second thread was closed because you already have a thread on the subject.
    And as we have said, forget all about if statements / switch cases, operators, etc. Focus on a flow chart first.
    And when you've done that, show us what you've accomplished so far and ask specific questions about what you are having trouble with.
    That's it.

Page 3 of 3 FirstFirst 123
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Roman Numerals
    By jfrizzy in forum C Programming
    Replies: 2
    Last Post: 11-23-2009, 07:43 PM
  2. integers to roman numerals(beginner)
    By FragileWarning1 in forum C++ Programming
    Replies: 2
    Last Post: 03-31-2007, 02:38 PM
  3. converting arabic to roman numerals
    By kaisha8 in forum C++ Programming
    Replies: 2
    Last Post: 09-26-2004, 02:02 AM
  4. Making roman numerals into arabic numbers
    By Mule in forum C++ Programming
    Replies: 2
    Last Post: 04-13-2003, 12:35 AM
  5. Need help with Roman Numerals
    By kiddprogrammer in forum C Programming
    Replies: 6
    Last Post: 04-01-2003, 11:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21