How do I make short form roman numerals with c++??

i have long form packed down farely well. i just need the last 2 "nothing" and "imverytired" to be short form roman numerals. ie (long form: 524=DXXIIII) (short form:524=DXXIV)
heres my code.. i really need help.




// roman_numeral.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <algorithm>
#include<math.h>
#include <ctype.h>
#include <cctype>
#include <functional>
using namespace std;
int main()




{

int x=0,i=0,n=0,w=0,e=0,q=0, start=0;
string nothing = "";
string imverytired = "";
string nothealthytired = "mdclxvi";
string roman = "MDCLXVI";
string p = "What would you like to start with? <1-5000>";
string o = "that number is not in the range of 1-5000.";

cout << "what would you like to start with? <1-5000>" ;
cin >> start;

while(start<1||start>5000)
{
cout<<"that number is not in the range of 1-5000.";
cout<< "what would you like to start with? <1-5000>";
cin >> start;
}
//..............................UPPER CASE................................
for(i=start;i<=start+20;i++)
{
x=i;
n=x/1000;
nothing.append(n,roman[0]);
x=x%1000;

n=x/500;
nothing.append(n,roman[1]);
x=x%500;

n=x/100;
nothing.append(n,roman[2]);
x=x%100;

n=x/50;
nothing.append(n,roman[3]);
x=x%50;

n=x/10;
nothing.append(n,roman[4]);
x=x%10;

n=x/5;
nothing.append(n,roman[5]);
x=x%5;

n=x/1;
nothing.append(n,roman[6]);
x=x%1;
//..............................................................................

//..................................lower case...............................

w=i;
q=w/1000;
imverytired.append(q,nothealthytired[0]);
w=w%1000;

q=w/500;
imverytired.append(q,nothealthytired[1]);
w=w%500;

q=w/100;
imverytired.append(q,nothealthytired[2]);
w=w%100;

q=w/50;
imverytired.append(q,nothealthytired[3]);
w=w%50;

q=w/10;
imverytired.append(q,nothealthytired[4]);
w=w%10;

q=w/5;
imverytired.append(q,nothealthytired[5]);
w=w%5;

q=w/1;
imverytired.append(q,nothealthytired[6]);
w=w%1;
//..............................................................................
cout<<i<<"="<<nothing<<"="<<imverytired<<"="<<nothing<<"="<<-------
imverytired<<endl;
nothing="";
imverytired="";
}








system("pause");
return 0;
}
Please use code blocks and put more commenting in for what your code is doing.
I'm sorry. What are code blocks?
It's what you get when you hit the"<>" Format icon to the right of the input
Topic archived. No new replies allowed.