### Arrays and Roman Numerals

I am writing a program that lets the user put in a value and the program puts the decimal and roman number into parallel arrays. I have never done an array but anyway right now I am working on the roman numeral part and the program keeps telling me "error- truncation of const and value" and "truncation from int to char" can someone tell me what I am doing wrong Please. This is what I have so far. I feel like a need to have a char up at the top?

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

int _tmain( )
{
string roman;
int interger;
int piece;

cout << "This program will turn an interger into the decimal and roman numbers equivalant to the interger." << endl;
cout << " Enter an interger" << endl;
cin >> interger;
if((interger >= 5000) || (interger <=0))
{
cout << endl << "Invalid Interger" << endl;
}
else
{

if(interger >=1000)

piece = (interger / 1000);
for(int i = 0; i < piece; i++)
{
roman += 'M';
}
interger%= 1000;
}

if( interger >= 100)
{
piece =(interger / 100);
if( piece ==9)
{
roman += 'CM';
}
else if (piece >= 5)
{
roman += 'D';

for( int i = 0; i < piece-5; i++)
{
roman += 'C';
}
}
else if ( piece == 4)
{
roman += 'CD';
}
else if (piece >1)
{
for( int i= 0; i < piece; i++)
{
roman += 'C';
}
}
interger %= 100;
}
if ( interger >= 10)
{
piece = (interger / 10);
if ( piece ==9)
{
roman += 'XC';
}
else if( piece >= 5)
{
roman += 'L';
for( int i = 0; i < piece-5; i++)
{
roman += 'X';
}
}
else if ( piece == 4)
{
roman += 'XL';
}
else if ( piece >= 1)
{
for( int i = 0; i < piece; i++)
{
roman += 'X';
}
}
interger %= 10;
}
if( interger >= 1)
{
piece = interger;

if( piece == 9)
{
roman += 'IX';
}
else if( piece >=5)
{
roman += 'V';
for( int i = 0; i < piece-5; i++)
{
roman += 'I';
}
}
else if( piece ==4)
{
roman += 'IV';
}
else if( piece >= 1)
{
for( int i = 0; i < piece; i++)
{
roman += 'I';
}
}
}
cout << "The roman number is" << " " << roman << endl;

system ("pause");
return 0;
}

I went back and looked at the directions and all I need to do is have the number that the user put in to be converted to long and short roman numbers. My question now is that are my numbers long roman or short and why does it keep giving me the error messages?
Last edited on
Topic archived. No new replies allowed.