// Roman Numeral Converter
// By DreamVB 23:56 17/10/2016

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

int main(int argc, char *argv[]){
	int Numerals[16] = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 };
	char *sRomans[16] = { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" };
	char sRomanVal[10];

	int i = 0;
	int j = 0;
	int Value = 0;
	int tempval = 0;

	//Get number of user.
	cout << "Enter a number : ";
	cin >> Value;
	
	//Make a copy
	tempval = Value;

	//Init sRomanVal
	strcpy(sRomanVal, "");

	for (i = 0; i <13; i++){
		while (Value >= Numerals[i]){
			Value -= Numerals[i];
			//Build the roman number string.
			strcat(sRomanVal, sRomans[i]);
		}
	}

	//Display the roman number.
	cout << endl << tempval << " in Roman Numeral is : " << sRomanVal << endl;

	system("pause");
	return 0;
}