473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

roman numbers

write a c++ program to convert natural numbers between 1 and 1000 to their roman equivalent??

1 -> I
10 -> X
100 -> C
500 -> L
Sep 28 '07 #1
4 1733
Savage
1,764 Expert 1GB
write a c++ program to convert natural numbers between 1 and 1000 to their roman equivalent??

1 -> I
10 -> X
100 -> C
500 -> L
All you need to do is to break up a number:

e.g

1111=1*10^0 + 1*10^1 + 1*10^2 +1*10^3

1*10^3=M
1*10^2=C
1*10^1=X
1*10^0=I

MCXI

And you will also need to enumerate roman numbers of first decade.

Savage
Sep 28 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
and don't forget that XL is 40, XC is 90, CD is 400, CM is 900, etc
Sep 28 '07 #3
Ganon11
3,652 Expert 2GB
And what about V = 5?
Sep 28 '07 #4
Savage
1,764 Expert 1GB
And what about V = 5?
Ehhem::

And you will also need to enumerate roman numbers of first decade.
Savage
Sep 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Ivo | last post by:
Hi, An array contains elements of the form , for example IVa, XIXb, LIX and LXIVc. Does anyone have a function which can sort this array in a way a human would expect it to, with the roman letters...
9
by: level9 | last post by:
How can I convert roman numerals to intergers in c++ VS 6?
13
by: Christopher Benson-Manica | last post by:
Inspired by a thread on clc++, I decided to try it out... #include <stdio.h> #include <stdlib.h> int main( int argc, char *argv ) { int i; int result=0; int this;
4
by: Patrick Blackman | last post by:
How do you write regular numbers eg 1 23 475896 in roman numerals inC#
7
by: daming23 | last post by:
Hi, I'm taking an online C++ class and having some difficulty understanding the assignments. Can someone please look at the code I wrote to ensure validity? I am not asking for the answer just some...
7
by: billbaitsg | last post by:
Hi, I need some help with figuring out why my program is all messed up. There are two portions two it, one that converts from roman to decimal (rom2dec) and another that converts from decimal to...
1
by: Evando | last post by:
I need a possible solution to tackle my assignment.The instruction again is to write a program code in C to convert from Roman numbers into Decimals.Any possible solution which will run is needed. ...
3
by: mookbooker | last post by:
I have a code written out with zero errors but i know my main() function is completely wrong and after i build the solution i compile it and nothing happens!! Not even cout statements please help. ...
1
by: vinothkumar86 | last post by:
how to convert natural numbers to roman numbers using c...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.