cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Roman_Numerals
Roman_Numerals
Aug 6, 2012 at 6:58am UTC
apeshit
(2)
Convert Roman numerals to Arabic form
How do i find a element in a array?
print out the index?
So far....
const char*unit[9] = {"I","II","III","IV","V","VI","VII","VIII","IX"};
const char* tens[9] = {"X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"};
const char* hundreds[9] = {"C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
const char* thousands[3] = {"M", "MM", "MMM"};
string str;
cout << "Enter the Roman Numeral in Capital letters (e.g. CCXIX) : ";
cin>> str;
Aug 6, 2012 at 7:27am UTC
closed account (
o3hC5Di1
)
Hi there,
you would do, for example:
std::cout << unit[2];
//outputs III
For more information: http://www.cplusplus.com/doc/tutorial/arrays/
All the best,
NwN
Aug 6, 2012 at 7:38am UTC
apeshit
(2)
The Input is The Roman_Numeral(eg...IX) the output should be 9. I also need to do loop so when the IX is not found in the array(units) it should move on to the next array(tens) and so on..
Topic archived. No new replies allowed.