Roman numeral program help (C++)

Discussion in 'Software' started by steve1132, May 23, 2004.

  1. steve1132

    steve1132 Private E-2

    I'm working on this Roman numeral project that i want to convert
    whole numbers less than or equal to 3,000 into Roman Numerals but it's a little tricky. I started something like this but i'm not so sure i'm on the right track:


    #include <iostream.h> //cin & cout

    int main()
    {

    //variables
    short num;
    unsigned short roman;

    cout << "Please enter a whole numbers less than or equal to 3,000\n";
    cout << "to be converted into a roman numeral.\n";
    cin >> num;


    if( num == 1 )
    {
    cout << endl;
    cout << "I\n";
    }
    if( num == 5 )
    {
    cout << endl;
    cout << "V\n";
    }
    if( num == 10 )
    {
    cout << endl;
    cout << "X\n";
    }
    if( num == 50 )
    {
    cout << endl;
    cout << "L\n";
    }
    if( num == 100 )
    {
    cout << endl;
    cout << "C\n";
    }
    if( num == 500 )
    {
    cout << endl;
    cout << "D\n";
    }
    if( num == 1000 )
    {
    cout << endl;
    cout << "M\n";

    }
    return 0;
    }



    Any pointers would be helpful
     
  2. steve1132

    steve1132 Private E-2

    nevermind, i have figured it out:rolleyes:
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds