Hello, I'm doing a homework assignment from my Computer Science course and I'm having a bit of trouble.
so far I have the code below and its producing errors, can anyone help? thanks!
#include <iostream>
#include <string>
using namespace std;
int main()
{
char ans;
int num;
do
{
string intToRoman(int num);
{
string roman;
int h,t,o;
static const char *ones[] = {"","I","II","III","IV","V","VI","VII","VIII","IX"};
static const char *tens[] = {"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"};
static const char *hundreds[] = {"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"};
static const char *thousands[] = {"","M","MM","MMM","MMMM","MMMMM"};
if (num <= 3000 || num >= 1000)
{
th = num / 1000;
num = num % 1000;
h = num % 100;
num = num % 100;
t = num / 10;
o = num % 10;
roman = roman + thousands[th] + hundreds[h] + tens[t] + ones[o];
cout << "The year you have entered converts to: " << roman << endl << endl;
break;
}
else
{
roman = "Please enter a number between 1000-3000\n";
}
}
cout << "Would you like to use this program again?\n";
cout << "If so, press y. If not, press another key\n";
cout << "followed by the enter key." << endl << endl;
cin >> ans;
}while(ans == 'y' || ans == 'Y');
system("pause");
return (0);
}