C++ Convert an Integer to Roman Numeral
###### Posted by Samath
Last Updated: January 20, 2024

This is a program that ask the user for a integer and convert it to roman numeral, it is written using the C++ programming language.

```#include <iostream>
#include <string>

using namespace std;

string roman_to_int(int value){
struct romanStruct { int value; char const* numeral; };
static romanStruct const romandata[] =
{ 1000, "M",
900, "CM",
500, "D",
400, "CD",
100, "C",
90, "XC",
50, "L",
40, "XL",
10, "X",
9, "IX",
5, "V",
4, "IV",
1, "I",
0, NULL };

string result;
for (romanStruct const* current = romandata; current->value > 0; ++current){
while (value >= current->value){
result += current->numeral;
value  -= current->value;
}
}
return result;
}

int main(){
int i=-1;

do{
cout << "Enter Integer [1-3999]: ";
cin >> i;
if(i==0){
cout << "Error";
}else{
cout << roman_to_int(i) << endl;
}

}while(i!=0);
}```

###### Convert Integer to Roman Numeral using C#
Samath | Jan 20, 2024
###### Convert Roman numerals to decimal using Java
Samath | Jan 17, 2024
###### Python program that test if integer values can form a triangle
Samath | Nov 06, 2014
###### Java program that reads an integer and prints how many digits the number has
Samath | Feb 11, 2021
###### C program that takes an 8-bit number and Convert it to hexadecimal format
Samath | Jan 01, 2017
###### C++ Convert from Decimal to Octal
Samath | Jan 05, 2017
###### Python to Convert Decimal to Binary, Octal and Hexadecimal
gideonna | Apr 13, 2016
###### C program to convert temperature from degree Celsius to Fahrenheit
Samath | Jan 02, 2017
###### Convert ASCII Character to Hexadecimal and Binary using C++
Samath | Jan 05, 2017
###### Python Convert Decimal to Binary or Binary to Decimal
Samath | Jan 09, 2017
###### Java program that convert meters to miles, feet, and inches
Samath | Feb 08, 2021
###### C++ Summing the digits in an integer
Samath | Jan 06, 2021
###### Recursive function that find the sum of digits in a integer using C++
Samath | Dec 24, 2014
###### Summing the Digits in an Integer using Python
Samath | Mar 02, 2015