progrm for converting integers to roman numerals using files in clanguage

Discussion in 'C Programming' started by kotlakirankumar@gmail.com, Jan 25, 2008.

  1. Guest

    please help me out the program for converting the integers to roman
    numerals using files in the c language from 1-5000 range send the
    program to my
    mail id :::::::
    thank you all
     
    , Jan 25, 2008
    #1
    1. Advertising

  2. Re: progrm for converting integers to roman numerals using files in c language

    said:

    > please help me out the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range send the
    > program to my
    > mail id


    Are you sure you're on the right course? You might find management more to
    your liking than programming.

    --
    Richard Heathfield <http://www.cpax.org.uk>
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999
     
    Richard Heathfield, Jan 25, 2008
    #2
    1. Advertising

  3. santosh Guest

    Re: progrm for converting integers to roman numerals using files in c language

    wrote:

    > please help me out the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range send the
    > program to my
    > mail id :::::::
    > thank you all


    You are joking right?

    No one is going to do your homework for you. Besides shirking at this
    stage is going to leave you looking a fool later on. Post some
    semblance of an attempt and you might likely get good help.
     
    santosh, Jan 25, 2008
    #3
  4. Sjouke Burry Guest

    Re: progrm for converting integers to roman numerals using filesin c language

    wrote:
    > please help me out the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range send the
    > program to my
    > mail id :::::::
    > thank you all

    Dork.
     
    Sjouke Burry, Jan 25, 2008
    #4
  5. Re: progrm for converting integers to roman numerals using files in c language

    writes:
    > please help me out the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range send the
    > program to my
    > mail id :::::::
    > thank you all


    Give us your instructor's e-mail address, and we'll be glad to send
    the solution directly to him. For a nominal fee, we'll mention your
    name.

    --
    Keith Thompson (The_Other_Keith) <>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
     
    Keith Thompson, Jan 25, 2008
    #5
  6. Mark Bluemel Guest

    Re: progrm for converting integers to roman numerals using filesin c language

    Keith Thompson wrote:
    > writes:
    >> please help me out the program for converting the integers to roman
    >> numerals using files in the c language from 1-5000 range send the
    >> program to my
    >> mail id :::::::
    >> thank you all

    >
    > Give us your instructor's e-mail address, and we'll be glad to send
    > the solution directly to him. For a nominal fee, we'll mention your
    > name.
    >

    For a larger fee we will fake the mail to appear to come from you.
     
    Mark Bluemel, Jan 25, 2008
    #6
  7. Randy Howard Guest

    Re: progrm for converting integers to roman numerals using files in c language

    On Thu, 24 Jan 2008 23:29:58 -0600, wrote
    (in article
    <>):

    > please help me out the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range send the
    > program to my
    > mail id :::::::


    As soon as $1000 hits my paypal account I'll send the solution. Have a
    nice day.


    --
    Randy Howard (2reply remove FOOBAR)
    "The power of accurate observation is called cynicism by those
    who have not got it." - George Bernard Shaw
     
    Randy Howard, Jan 25, 2008
    #7
  8. On 25 Jan, 05:29, wrote:

    > please help me out  the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range send the
    > program to my
    >  mail id :::::::    
    >   thank you all


    what does "using files" mean? Can't we dream up a bizzare way of
    implementing this? Use file names to store the numbers?

    I.dat contains 1
    V.dat contains 10
    etc.

    or
    1.dat contains I
    5.dat contains V

    <pause>

    spilt the input into "decades" number 1000's number of 100's
    then use the number to generate a filename. Which contains the
    answer.

    0 -> <empty>
    1 -> "I"
    2 -> "II"

    no probably too silly.

    To the OP. Do it on paper first.


    --
    Nick Keighley
     
    Nick Keighley, Jan 25, 2008
    #8
  9. Eric Sosman Guest

    Re: progrm for converting integers to roman numerals using filesin c language

    wrote:
    > please help me out the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range send the
    > program to my
    > mail id :::::::


    Ask here, get answers here.

    #include<stdio.h>
    #define LO 1
    #define HI 5000
    #define SPAN(min,max)(1-((max)-(min)))
    static char*r[SPAN(HI,LO)]={"I","II","III",
    /* ... fill in remaining values here ... */
    "MMMMCMXCVIII","MMMMCMXCIX","?"};
    int main(int argc,char**argv){
    if(argv!=r)return main(SPAN(HI,LO),r);
    for(puts(*argv);--argc;puts(*++argv));
    return argc;
    }

    --
    Eric Sosman
    lid
     
    Eric Sosman, Jan 25, 2008
    #9
  10. Bart C Guest

    Re: progrm for converting integers to roman numerals using files in c language

    "Eric Sosman" <> wrote in message
    news:...
    > wrote:
    >> please help me out the program for converting the integers to roman
    >> numerals using files in the c language from 1-5000 range send the
    >> program to my
    >> mail id :::::::

    >
    > Ask here, get answers here.
    >
    > #include<stdio.h>
    > #define LO 1
    > #define HI 5000
    > #define SPAN(min,max)(1-((max)-(min)))
    > static char*r[SPAN(HI,LO)]={"I","II","III",
    > /* ... fill in remaining values here ... */
    > "MMMMCMXCVIII","MMMMCMXCIX","?"};


    Above 1000 you use V, X, L etc with a 'bar' over to scale by 1000.

    So not so easy, unless you use a convention like /V.

    And the 4000 above looks better as MV-Bar I think. Might be wrong though.

    --
    Bart
     
    Bart C, Jan 25, 2008
    #10
  11. Randy Howard Guest

    Re: progrm for converting integers to roman numerals using files in c language

    On Fri, 25 Jan 2008 11:02:19 -0600, Bart C wrote
    (in article <vComj.83078$>):

    >
    > "Eric Sosman" <> wrote in message
    > news:...
    >> wrote:
    >>> please help me out the program for converting the integers to roman
    >>> numerals using files in the c language from 1-5000 range send the
    >>> program to my
    >>> mail id :::::::

    >>
    >> Ask here, get answers here.
    >>
    >> #include<stdio.h>
    >> #define LO 1
    >> #define HI 5000
    >> #define SPAN(min,max)(1-((max)-(min)))
    >> static char*r[SPAN(HI,LO)]={"I","II","III",
    >> /* ... fill in remaining values here ... */
    >> "MMMMCMXCVIII","MMMMCMXCIX","?"};

    >
    > Above 1000 you use V, X, L etc with a 'bar' over to scale by 1000.
    >
    > So not so easy, unless you use a convention like /V.
    >
    > And the 4000 above looks better as MV-Bar I think. Might be wrong though.


    How about:

    _ _ _
    V X L

    etc.



    --
    Randy Howard (2reply remove FOOBAR)
    "The power of accurate observation is called cynicism by those
    who have not got it." - George Bernard Shaw
     
    Randy Howard, Jan 25, 2008
    #11
  12. Army1987 Guest

    [OT] Re: progrm for converting integers to roman numerals usingfiles in c language

    Bart C wrote:

    > Above 1000 you use V, X, L etc with a 'bar' over to scale by 1000.
    >
    > So not so easy, unless you use a convention like /V.
    >
    > And the 4000 above looks better as MV-Bar I think. Might be wrong though.
    >

    __
    4000 is IV, though MMMM is also used (but becomes awkward for larger
    numbers. _
    Numbers from one million onwards are written as |X|, the "box" multiplying
    by 10**5.

    --
    Army1987 (Replace "NOSPAM" with "email")
     
    Army1987, Jan 25, 2008
    #12
  13. CBFalconer Guest

    Keith Thompson wrote:
    > writes:
    >
    >> please help me out the program for converting the integers to
    >> roman numerals using files in the c language from 1-5000 range
    >> send the program to my mail id ::

    >
    > Give us your instructor's e-mail address, and we'll be glad to
    > send the solution directly to him. For a nominal fee, we'll
    > mention your name.


    It's actually quite simple. Simply list the 5000 Roman values in
    order, i.e.:

    I
    II
    III
    IV
    ...
    IMMMMM
    MMMMM

    and put those strings into the array ROMANS. i.e.:

    char *romans[] = ( /* here the above comma separated set */ );
    /* Don't forget to quote each string. */

    Now the conversion and printing is simply:

    /* write i in roman numerals */
    int iwrite(i) {
    return puts(roman[i - 1]);
    }

    which returns EOF for any i/o error, else a positive int.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.



    --
    Posted via a free Usenet account from http://www.teranews.com
     
    CBFalconer, Jan 25, 2008
    #13
  14. Re: progrm for converting integers to roman numerals using files in c language

    wrote:

    > please help me out


    Here you go...

    > the program for converting the integers to roman
    > numerals using files in the c language from 1-5000 range


    Find below the portable C source code for a program that will print
    all roman numerals from 0 to 5000. Changing the code so it starts
    with 1 is left as an exercise.

    [snips]

    > thank you all


    You're welcome.

    Here comes the code...

    /*
    * runum.c
    *
    * Copyright (c) 2008, John J. Smith
    *
    * Permission to use, copy, modify, distribute, and sell this software
    * and its documentation for any purpose except in homework assignments
    * is hereby granted without fee, provided that the above copyright
    * notice appear in all copies and that both that copyright notice and
    * this permission notice appear in supporting documentation.
    *
    */

    /*
    * Requirements:
    *
    * the program for converting the integers to roman
    * numerals using file(s) in the c language from 1-5000 range
    *
    */

    #include <stdio.h>
    #include <string.h>

    /*
    * the biggest foobarfoobar that foofoobarbar will accept
    */
    #define MAX_FOOBARFOOBAR 5000

    #define M 1000
    #define D 500
    #define C 100
    #define L 50
    #define X 10
    #define V 5
    #define I 1
    #define N 0

    /*
    * struct: foofoofoofoo
    *
    * purpose: map foofoofoobar values to their corresponding
    * foofoobarfoo values
    *
    */
    #define M1(a) { #a , (a) }
    #define M2(a,b) { #a #b , (b)-(a) }

    static struct {
    char *foofoofoobar;
    int foofoobarfoo;
    } foofoofoofoo[] = {
    M1(M),M2(C,M),M1(D),M2(C,D),M1(C),M2(X,C),M1(L),
    M2(X,L),M1(X),M2(I,X),M1(V),M2(I,V),M1(I),M1(N),
    };
    #define N_FOOFOOFOOFOO \
    ((sizeof foofoofoofoo) / (sizeof foofoofoofoo[0]))

    #undef M1
    #undef M2

    static int ConstraintFailed(void) { return -1; }

    /*
    * function: foofoobarbar
    *
    * purpose: convert a foobarfoobar value to foobarbarfoo
    *
    * parameters:
    * foobarfoobar: value to be converted
    * foobarbarfoo: buffer that receives the converted foobarfoobar
    *
    * notes:
    * it is the callers responsiblility that foobarbarfoo is
    * sufficiently large
    */
    static int foofoobarbar(int foobarfoobar, char *foobarbarfoo)
    {
    int barfoobarfoo = 0;
    size_t barbarfoofoo;
    char *foobarbarbar;

    if(foobarfoobar < 0 || foobarfoobar > MAX_FOOBARFOOBAR) {
    barfoobarfoo = ConstraintFailed();
    strcpy(foobarbarfoo, "ERROR!"); goto barfoobarbar;
    }
    else if(foobarfoobar == 0) {
    strcpy(foobarbarfoo, "N"); goto barfoobarbar;
    }

    for(foobarbarbar = foobarbarfoo, *foobarbarbar = 0, barbarfoofoo = 0;
    barbarfoofoo < N_FOOFOOFOOFOO-1; barbarfoofoo++) {
    while(foobarfoobar >= foofoofoofoo[barbarfoofoo].foofoobarfoo) {
    char *barfoofoofoo = foofoofoofoo[barbarfoofoo].foofoofoobar;
    size_t barfoofoobar = strlen(barfoofoofoo);
    memcpy(foobarbarbar, barfoofoofoo, barfoofoobar);
    foobarbarbar += barfoofoobar;
    foobarfoobar -= foofoofoofoo[barbarfoofoo].foofoobarfoo;
    }
    }
    *foobarbarbar = '\0';

    barfoobarbar:
    return barfoobarfoo;
    }

    /*
    * function: foobarfoofoo
    *
    * purpose: as per spec, use file foobarfoobar
    *
    * parameters: (none)
    */
    static int foobarfoofoo(void)
    {
    FILE *foobarfoobar;
    printf("Using file... ");
    if((foobarfoobar = tmpfile()) != NULL) {
    printf("success!!!\n");
    fclose(foobarfoobar);
    return 0;
    } else {
    printf("failed.\n");
    return 1;
    }
    }


    /*
    * function: main
    *
    * purpose: program's entry point
    * invokes foofoobarbar() MAX_FOOBARFOOBAR times
    */
    int main(void)
    {
    int foobarfoobar;
    char foobarbarfoo[64];

    printf("John's Table of Roman Numerals\n"
    "Copyright (c) MMVIII, John J. Smith\n\n");
    foobarfoofoo();
    printf("\n"
    " arabic | roman\n"
    "--------+----------------------\n");
    for(foobarfoobar = 0;
    foobarfoobar <= MAX_FOOBARFOOBAR;
    foobarfoobar++) {
    foofoobarbar(foobarfoobar, foobarbarfoo);
    printf(" %5d | %s\n", foobarfoobar, foobarbarfoo);
    }
    return 0;
    }

    /* end ronum.c */

    --
    John J. Smith
    Homework Expert
     
    John J. Smith, Jan 27, 2008
    #14
  15. Re: progrm for converting integers to roman numerals using files in c language

    On Sun, 27 Jan 2008 03:10:28 +0100 (CET), John J. Smith
    <> wrote:

    > wrote:
    >
    >> please help me out

    >
    >Here you go...
    >
    >> the program for converting the integers to roman
    >> numerals using files in the c language from 1-5000 range

    >
    >Find below the portable C source code for a program that will print
    >all roman numerals from 0 to 5000. Changing the code so it starts
    >with 1 is left as an exercise.
    >
    >[snips]
    >
    >> thank you all

    >
    >You're welcome.
    >
    >Here comes the code...


    Does not compile with LCC-WIN32...

    |
    |Error ronum.c: 62 redefinition of 'ConstraintFailed'
    |Error c:\lcc\include\safelib.h: 3 Previous definition of 'ConstraintFailed' here
    |Warning ronum.c: 62 inconsistent linkage for 'ConstraintFailed' previously declared at c:\lcc\include\safelib.h 3
    |2 errors, 1 warning
    |1 error
    |

    (and I don't even know what "safelib.h" is. Program or compiler problem?)


    >/*
    > * runum.c
    > *
    > * Copyright (c) 2008, John J. Smith
    > *
    > * Permission to use, copy, modify, distribute, and sell this software
    > * and its documentation for any purpose except in homework assignments
    > * is hereby granted without fee, provided that the above copyright
    > * notice appear in all copies and that both that copyright notice and
    > * this permission notice appear in supporting documentation.
    > *
    > */
    >
    >/*
    > * Requirements:
    > *
    > * the program for converting the integers to roman
    > * numerals using file(s) in the c language from 1-5000 range
    > *
    > */
    >
    >#include <stdio.h>
    >#include <string.h>
    >
    >/*
    > * the biggest foobarfoobar that foofoobarbar will accept
    > */
    >#define MAX_FOOBARFOOBAR 5000
    >
    >#define M 1000
    >#define D 500
    >#define C 100
    >#define L 50
    >#define X 10
    >#define V 5
    >#define I 1
    >#define N 0
    >
    >/*
    > * struct: foofoofoofoo
    > *
    > * purpose: map foofoofoobar values to their corresponding
    > * foofoobarfoo values
    > *
    > */
    >#define M1(a) { #a , (a) }
    >#define M2(a,b) { #a #b , (b)-(a) }
    >
    >static struct {
    > char *foofoofoobar;
    > int foofoobarfoo;
    >} foofoofoofoo[] = {
    > M1(M),M2(C,M),M1(D),M2(C,D),M1(C),M2(X,C),M1(L),
    > M2(X,L),M1(X),M2(I,X),M1(V),M2(I,V),M1(I),M1(N),
    >};
    >#define N_FOOFOOFOOFOO \
    > ((sizeof foofoofoofoo) / (sizeof foofoofoofoo[0]))
    >
    >#undef M1
    >#undef M2
    >
    >static int ConstraintFailed(void) { return -1; }
    >
    >/*
    > * function: foofoobarbar
    > *
    > * purpose: convert a foobarfoobar value to foobarbarfoo
    > *
    > * parameters:
    > * foobarfoobar: value to be converted
    > * foobarbarfoo: buffer that receives the converted foobarfoobar
    > *
    > * notes:
    > * it is the callers responsiblility that foobarbarfoo is
    > * sufficiently large
    > */
    >static int foofoobarbar(int foobarfoobar, char *foobarbarfoo)
    >{
    > int barfoobarfoo = 0;
    > size_t barbarfoofoo;
    > char *foobarbarbar;
    >
    > if(foobarfoobar < 0 || foobarfoobar > MAX_FOOBARFOOBAR) {
    > barfoobarfoo = ConstraintFailed();
    > strcpy(foobarbarfoo, "ERROR!"); goto barfoobarbar;
    > }
    > else if(foobarfoobar == 0) {
    > strcpy(foobarbarfoo, "N"); goto barfoobarbar;
    > }
    >
    > for(foobarbarbar = foobarbarfoo, *foobarbarbar = 0, barbarfoofoo = 0;
    > barbarfoofoo < N_FOOFOOFOOFOO-1; barbarfoofoo++) {
    > while(foobarfoobar >= foofoofoofoo[barbarfoofoo].foofoobarfoo) {
    > char *barfoofoofoo = foofoofoofoo[barbarfoofoo].foofoofoobar;
    > size_t barfoofoobar = strlen(barfoofoofoo);
    > memcpy(foobarbarbar, barfoofoofoo, barfoofoobar);
    > foobarbarbar += barfoofoobar;
    > foobarfoobar -= foofoofoofoo[barbarfoofoo].foofoobarfoo;
    > }
    > }
    > *foobarbarbar = '\0';
    >
    >barfoobarbar:
    > return barfoobarfoo;
    >}
    >
    >/*
    > * function: foobarfoofoo
    > *
    > * purpose: as per spec, use file foobarfoobar
    > *
    > * parameters: (none)
    > */
    >static int foobarfoofoo(void)
    >{
    > FILE *foobarfoobar;
    > printf("Using file... ");
    > if((foobarfoobar = tmpfile()) != NULL) {
    > printf("success!!!\n");
    > fclose(foobarfoobar);
    > return 0;
    > } else {
    > printf("failed.\n");
    > return 1;
    > }
    >}
    >
    >
    >/*
    > * function: main
    > *
    > * purpose: program's entry point
    > * invokes foofoobarbar() MAX_FOOBARFOOBAR times
    > */
    >int main(void)
    >{
    > int foobarfoobar;
    > char foobarbarfoo[64];
    >
    > printf("John's Table of Roman Numerals\n"
    > "Copyright (c) MMVIII, John J. Smith\n\n");
    > foobarfoofoo();
    > printf("\n"
    > " arabic | roman\n"
    > "--------+----------------------\n");
    > for(foobarfoobar = 0;
    > foobarfoobar <= MAX_FOOBARFOOBAR;
    > foobarfoobar++) {
    > foofoobarbar(foobarfoobar, foobarbarfoo);
    > printf(" %5d | %s\n", foobarfoobar, foobarbarfoo);
    > }
    > return 0;
    >}
    >
    >/* end ronum.c */
     
    Hans Schneider, Jan 27, 2008
    #15
  16. Flash Gordon Guest

    Re: progrm for converting integers to roman numerals using filesin c language

    Hans Schneider wrote, On 27/01/08 03:15:
    > On Sun, 27 Jan 2008 03:10:28 +0100 (CET), John J. Smith
    > <> wrote:
    >
    >> wrote:
    >>
    >>> please help me out

    >> Here you go...
    >>
    >>> the program for converting the integers to roman
    >>> numerals using files in the c language from 1-5000 range

    >> Find below the portable C source code for a program that will print
    >> all roman numerals from 0 to 5000. Changing the code so it starts
    >> with 1 is left as an exercise.
    >>
    >> [snips]
    >>
    >>> thank you all

    >> You're welcome.
    >>
    >> Here comes the code...

    >
    > Does not compile with LCC-WIN32...
    >
    > |
    > |Error ronum.c: 62 redefinition of 'ConstraintFailed'
    > |Error c:\lcc\include\safelib.h: 3 Previous definition of 'ConstraintFailed' here
    > |Warning ronum.c: 62 inconsistent linkage for 'ConstraintFailed' previously declared at c:\lcc\include\safelib.h 3
    > |2 errors, 1 warning
    > |1 error
    > |
    >
    > (and I don't even know what "safelib.h" is. Program or compiler problem?)


    <snip>

    If you put the compiler in to conforming mode (-ansic is I think the
    switch) then it is a compiler problem. If not then I would still say it
    is a compiler problem, but it could be a deliberate feature.

    C code is allowed to use the identifier ConstraintFailed for anything it
    wants.
    --
    Flash Gordon
     
    Flash Gordon, Jan 27, 2008
    #16
  17. Re: progrm for converting integers to roman numerals using filesin c language

    Hans Schneider wrote:
    >
    > Does not compile with LCC-WIN32...
    >
    > |
    > |Error ronum.c: 62 redefinition of 'ConstraintFailed'
    > |Error c:\lcc\include\safelib.h: 3 Previous definition of 'ConstraintFailed' here


    Bug in lcc-win32, or you're not invoking it in conforming mode.

    ConstraintFailed is a valid identifier which lcc-win32 happens to use
    in some implementation-specific library. You need to disable compiler
    extensions.
     
    Mark McIntyre, Jan 27, 2008
    #17
  18. santosh Guest

    Re: progrm for converting integers to roman numerals using files in c language

    Hans Schneider wrote:

    > On Sun, 27 Jan 2008 03:10:28 +0100 (CET), John J. Smith
    > <> wrote:
    >
    >> wrote:
    >>
    >>> please help me out

    >>
    >>Here you go...
    >>
    >>> the program for converting the integers to roman
    >>> numerals using files in the c language from 1-5000 range

    >>
    >>Find below the portable C source code for a program that will print
    >>all roman numerals from 0 to 5000. Changing the code so it starts
    >>with 1 is left as an exercise.
    >>
    >>[snips]
    >>
    >>> thank you all

    >>
    >>You're welcome.
    >>
    >>Here comes the code...

    >
    > Does not compile with LCC-WIN32...
    >
    > |
    > |Error ronum.c: 62 redefinition of 'ConstraintFailed'
    > |Error c:\lcc\include\safelib.h: 3 Previous definition of
    > |'ConstraintFailed' here
    > |Warning ronum.c: 62 inconsistent linkage for 'ConstraintFailed'
    > |previously declared at c:\lcc\include\safelib.h 3 2 errors, 1 warning
    > |1 error
    > |
    >
    > (and I don't even know what "safelib.h" is. Program or compiler
    > problem?)


    Please post problems with lcc-win32 to <news:comp.compilers.lcc> where
    it's author will be able to address them.

    PS. I'm surprised that jacob is using an user-space identifier in his
    implementation, even in non-conforming mode. Unfortunately I have not
    got Windows, so I cannot check this myself at the moment.

    <snip code>
     
    santosh, Jan 27, 2008
    #18
  19. Bartc Guest

    Re: progrm for converting integers to roman numerals using files in c language

    Hans Schneider wrote:
    > On Sun, 27 Jan 2008 03:10:28 +0100 (CET), John J. Smith
    > <> wrote:
    >
    >> wrote:


    >> Find below the portable C source code for a program that will print
    >> all roman numerals from 0 to 5000. Changing the code so it starts
    >> with 1 is left as an exercise.


    > Does not compile with LCC-WIN32...


    > (and I don't even know what "safelib.h" is. Program or compiler
    > problem?)


    This worked fine for me. Although had to rename the ConstraintFailed
    function.

    safelib.h seems to be used in the string.h header.

    And the output seems fine apart from slight quibble of using MMMMM for 5000.

    --
    Bart
     
    Bartc, Jan 27, 2008
    #19
  20. Coos Haak Guest

    Re: progrm for converting integers to roman numerals using files in c language

    Op Sun, 27 Jan 2008 19:14:38 GMT schreef Bartc:

    > Hans Schneider wrote:
    >> On Sun, 27 Jan 2008 03:10:28 +0100 (CET), John J. Smith
    >> <> wrote:
    >>
    >>> wrote:

    >
    >>> Find below the portable C source code for a program that will print
    >>> all roman numerals from 0 to 5000. Changing the code so it starts
    >>> with 1 is left as an exercise.

    >
    >> Does not compile with LCC-WIN32...

    >
    >> (and I don't even know what "safelib.h" is. Program or compiler
    >> problem?)

    >
    > This worked fine for me. Although had to rename the ConstraintFailed
    > function.
    >
    > safelib.h seems to be used in the string.h header.
    >
    > And the output seems fine apart from slight quibble of using MMMMM for 5000.


    Slight? Everything from 4000 onwards had at least four M's in a row ;-)
    Perhaps the Romans used a wide (high) character set, the A in ASCII surely
    wasn't known then.
    --
    Coos
     
    Coos Haak, Jan 27, 2008
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christopher Benson-Manica

    Roman numerals to ints

    Christopher Benson-Manica, Sep 12, 2003, in forum: C Programming
    Replies:
    13
    Views:
    737
    MikeyD
    Sep 17, 2003
  2. ARMAS

    Decimal to Roman Numerals

    ARMAS, Jan 24, 2007, in forum: C Programming
    Replies:
    31
    Views:
    1,744
    Dave Thompson
    Feb 6, 2007
  3. Roman Numerals

    , Aug 17, 2007, in forum: Java
    Replies:
    10
    Views:
    950
    Roedy Green
    Aug 18, 2007
  4. Ruby Quiz

    [QUIZ] Roman Numerals (#22)

    Ruby Quiz, Mar 4, 2005, in forum: Ruby
    Replies:
    25
    Views:
    371
    James Edward Gray II
    Mar 9, 2005
  5. Ruby Quiz

    [SUMMARY] Roman Numerals (#22)

    Ruby Quiz, Mar 10, 2005, in forum: Ruby
    Replies:
    0
    Views:
    169
    Ruby Quiz
    Mar 10, 2005
Loading...

Share This Page