Decimal to Roman Numerals

A

ARMAS

Make a program that allows the user to input a number and aoutput it's
roman numeral equivalent..... plzzzzzz help....
Ex: 109 output:CIX
 
L

Lew Pitcher

Make a program that allows the user to input a number and aoutput it's
roman numeral equivalent..... plzzzzzz help....
Ex: 109 output:CIX

OK, show us what you've got so far, and we'll make suggestions
 
A

ARMAS

I have no idea .... i'm just a feshmen.... maybe i could try but it
wil take me a long time... and i need a quick answer... plzzzz
 
U

user923005

I'm asking for help, not a bullshit answer

That is where you are wrong (in both regards).
You are not asking for help. You are asking for someone to do your
homework for you. That is decidedly not helpful for your future but
harmful.
Because of your attitude, I am sure that any code answer you receive
will be rather humorous.
 
A

ARMAS

You are not asking for help. You are asking for someone to do your
homework for you. That is decidedly not helpful for your future but
harmful.
Because of your attitude, I am sure that any code answer you receive
will be rather humorous.


It ain't a homework....
 
K

Keith Thompson

No, you're asking us to do your homework for you.

If you're unable to do it yourself, we'd prefer that you fail the
class.

If you want *help*, we might be able to provide some, but we're not
going to do it all for you.
 
U

user923005

/*
Since we know it's not for school but he just needs this to do his
important work,
I decided to write a nice converter for him. Enjoy:
*/
#include<stdio.h>
#include<stdlib.h>
int main(int q0,char*q1??(??))??<long q2,q3;int q4=1;typedef struct q5
??<int q6;char*q7;int q8;char*q9;??>q10;q10 q11??(??)=??<
#ifdef q12
??<1000000,"\74\115\55\142\141\162\76",900000,
"\74\103\115\55\142\141\162\76"??>,??<500000,
"\74\104\55\142\141\162\76",400000,"\74\103\104\55\142\141\162\
\76"??>,??<100000,"\74\103\55\142\141\162\76",90000,
"\74\130\103\55\142\141\162\76"??>,??<50000,
"\74\114\55\142\141\162\76",40000,"\74\130\114\55\142\141\162\
\76"??>,??<10000,"\74\130\55\142\141\162\76",9000,
"\74\111\130\55\142\141\162\76"??>,??<5000,"\74\126\55\142\141\162\76"
,4000,"\74\111\126\55\142\141\162\76"??>,
#endif
??<1000,"\115",900,"\103\115"??>,??<500,"\104",400,"\103\104"??>,??<
100,"\103",90,"\130\103"??>,??<50,"\114",40,"\130\114"??>,??<10,"\130"
,9,"\111\130"??>,??<5,"\126",4,"\111\126"??>,??<1,"\111",1,"\111"??>
??>;int q13=0;if(q0==2)q2=atol(q1??(1??));else??<if(q0==3)??<q2=atol(
q1??(1??));q4=0;??>else??<printf("\n\105\156\164\145\162\40\141\156\40"
"\151\156\164\145\147\145\162\40\166\141\154\165\145\72\40"
);scanf("\45\154\144",&q2);??>??>q3=q2;printf("\n\45\154\144\40\75\40"
,q3);do??<while(q2>=q11??(q13??).q6)??<printf("\45\163",q11??(q13??).
q7);q2-=q11??(q13??).q6;??>if(q4)if(q2>=q11??(q13??).q8)??<printf(
"\45\163",q11??(q13??).q9);q2-=q11??(q13??).q8;??>q13++;??>while(q2>0)
;return(0);??>
 
D

David T. Ashley

ARMAS said:
I have no idea .... i'm just a feshmen.... maybe i could try but it
wil take me a long time... and i need a quick answer... plzzzz

There are these things called "books". You probably have not heard of them.
They are in:

a)Libraries.

b)Bookstores.

c)Other places.

You may want to explore "books"; specifically a book about the 'C'
programming language.

When you have something resembling a program that you can't get to work,
feel free to post back to this newsgroup.

Also, if you want to hire me to do your program, I will do a "Roman Numeral"
program for USD $1,500. That is probably about $25/line.

There may be others in this newsgroup who will do it for less. I won't be
hurt if you contract with one of them.
 
K

Kenneth Brody

ARMAS said:
It ain't a homework....

Then what is it? All available evidence says otherwise.

Quoting your previous post:
i'm just a feshmen....

Translation: I'm in school.
maybe i could try but it wil take me a long time...

Translation: I'm lazy.
and i need a quick answer...

Translation: The assignment is due tomorrow.

You've also said you have "no idea" on how to do this. If that's
the case, why are you doing this?

Conclusion: It's homework.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
D

Dave Vandervies

David T. Ashley said:
Also, if you want to hire me to do your program, I will do a "Roman Numeral"
program for USD $1,500. That is probably about $25/line.

There may be others in this newsgroup who will do it for less. I won't be
hurt if you contract with one of them.

No, no, you don't understand the way we do things here.

Offers of contracts to do homework problems are traditionally done on a
"highest bid" basis; the offer includes a clause that it is invalidated
by anybody posting a higher offer to the thread in which it is made.

I am willing to write a roman numeral converter for the OP for US$2000,
payment in advance by certified check or money order. This offer is
valid until midnight (UTC) this Friday, 2007-01-26, or until a higher
offer is made, whichever comes sooner.


dave
 
K

Keith Thompson

No, no, you don't understand the way we do things here.

Offers of contracts to do homework problems are traditionally done on a
"highest bid" basis; the offer includes a clause that it is invalidated
by anybody posting a higher offer to the thread in which it is made.

I am willing to write a roman numeral converter for the OP for US$2000,
payment in advance by certified check or money order. This offer is
valid until midnight (UTC) this Friday, 2007-01-26, or until a higher
offer is made, whichever comes sooner.

Isn't it also traditional to offer a discount if the solution can be
submitted directly to the instructor?
 
C

Christopher Benson-Manica

ARMAS said:
I have no idea .... i'm just a feshmen.... maybe i could try but it
wil take me a long time... and i need a quick answer... plzzzz

Either try it yourself or accept that maybe you should have started
this little project a little bit earlier. Plenty of freshmen before
you have figured at least that much out, or possibly gone on to flip
burgers. You still have a choice; I suggest you choose wisely.
 
U

user923005

[email protected] (Dave Vandervies) said:
submitted directly to the instructor?

I already posted a working solution (under conditional compilation it
also uses the bar notation for huge roman numeral values) and thereby
claim all prizes.
I also get the grade, if it is above a C.
However, getting tossed out on your ear for plagiarism I leave to the
O.P. untouched and pristine.
 
R

rsood

[email protected] (Dave Vandervies) said:
Isn't it also traditional to offer a discount if the solution can be
submitted directly to the instructor?

I bid my college tuition for next year - see
http://www.virginia.edu/Facts/Glance_Tuition.htm - plus expenses (I
figure your pry going to want it to run on Alpha systems, so I going to
want one of those to develop on - see
http://h18002.www1.hp.com/alphaserver - hurry, sale ends soon. A SPARC
system might also be nice.) I'll assign the copyrights of the code to
you, but I keep the hardware.

-Ravi Sood http://accordian.sourceforge.net
 
S

Simon Biber

ARMAS said:
Make a program that allows the user to input a number and aoutput it's
roman numeral equivalent..... plzzzzzz help....
Ex: 109 output:CIX

I wrote a program to do this. I won't give you all of it but I will give
you a framework where you can fill in the algorithm.

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

/*
Known Roman numerals are:
I=1, V=5, X=10, L=50, C=100, D=500, M=1000
Anything greater is represented by appending '~'s.
Each '~' represents multiplication by 1000.

The length of the input is unlimited.
*/

static const char *rom[] = {
"", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX",
"", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC",
"", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"
};

int main(int argc, char **argv)
{
size_t i, j, k, len, m, numdig;
const char *p;

if(argc != 2)
{
fprintf(stderr, "Usage requires one argument: "
"a decimal number to convert.\n");
return 0;
}
numdig = strlen(argv[1]);
for(i = 0; i < numdig; i++)
{
j = numdig - i - 1; /* reverse index */

if(argv[1] < '0' || argv[1] > '9')
{
putchar('\n');
fprintf(stderr, "Invalid digit: %c\n", argv[1]);
return 0;
}

/* Add your algorithm here. How to determine
which element of the 'rom' array to
output?

It's all about mathematics. Think about the
values of:

argv[1] - '0'

j % 3

j % 3 * 10

j / 3
*/

}
putchar('\n');
return 0;
}
 
A

Andrew Gentile

If this isn't homework, I would love to know how you ended up with such
a project.
 
R

Rethish

Hi;

I would like to learn how the below mentioned program works.

how does ??< evaluate to a '(' and how ??( to '['

could u ppl give a short explanation and if possible point me to some
info I can read to get more info on this.

Thanks & regards
Rethish
 
C

Chris Dollin

Rethish said:
I would like to learn how the below mentioned program works.

how does ??< evaluate to a '(' and how ??( to '['

It's (an obscure) part of the definition of C; they're called
"trigraphs". They don't 'evaluate', they represent.
could u ppl give a short explanation and if possible point me to some
info I can read to get more info on this.

Please don't abbreviate "you" and "people" like that. It makes
your text harder to read for old-timers like what I am. There'
no hortage of vowel on Uenet.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top