C++ converting base 10 to Roman numerals

  • Thread starter Thread starter Math Is Hard
  • Start date Start date
  • Tags Tags
    Base C++
Click For Summary
SUMMARY

The forum discussion focuses on converting base 10 numbers to Roman numerals using C++. The original poster struggles with implementing a loop to handle the conversion efficiently without using arrays, as they are not yet familiar with that concept. Suggestions include using functions to encapsulate repeated logic and employing subtraction instead of division for better clarity and efficiency. The conversation also touches on the correct representation of Roman numerals, emphasizing the need for proper ordering and formatting.

PREREQUISITES
  • C++ programming fundamentals
  • Understanding of loops and conditional statements
  • Basic knowledge of Roman numeral rules
  • Familiarity with functions in C++
NEXT STEPS
  • Implement a function to convert individual decimal digits to Roman numeral components
  • Research C++ string manipulation techniques for building Roman numeral outputs
  • Explore the use of recursion in C++ for handling repetitive tasks
  • Study the historical rules of Roman numeral formatting for accurate conversions
USEFUL FOR

Programmers learning C++, students studying algorithms, and anyone interested in numeral systems and their conversions.

  • #61
If you want to count more than 3999, you would use parentheses around letters as explained at http://mathworld.wolfram.com/RomanNumerals.html. You wouldn't write MMMM. 4000 would be written M(V)

Edit: Or you could add a vinculum by using 2 lines of output and an underscore.

If for some reason you want to use more than 3 M's, you can just add more M's at the end of string s.

Yes, that's how the conditional statement works.
 
Last edited:

Similar threads

  • · Replies 22 ·
Replies
22
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 15 ·
Replies
15
Views
12K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
7
Views
16K
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K