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

Homework Help Overview

The discussion revolves around converting base 10 numbers to Roman numerals using C++. Participants are exploring various programming techniques and logic to implement this conversion effectively.

Discussion Character

  • Exploratory, Conceptual clarification, Problem interpretation

Approaches and Questions Raised

  • The original poster attempts to create a program for conversion but struggles with implementing a loop for counting Roman numeral symbols. Some participants suggest using arrays, while others propose alternative methods due to constraints on using arrays. There are discussions about the efficiency of division versus subtraction in the conversion process.

Discussion Status

Participants are actively sharing ideas and suggestions, with some providing alternative approaches to the problem. There is no explicit consensus on a single method, but various productive directions are being explored, including the use of functions and iterative logic.

Contextual Notes

Some participants mention constraints on using arrays and the need to handle specific cases in Roman numeral formatting. There is also a focus on ensuring the correct order of symbols in the final output.

  • #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