I wrote a program which reads a file containing roman numerals and translates it into integers. I am sure that my coding is done well but the only thing that seems messed up is that the program is not reading the file. Can you spot what I am doing wrong here?
void calc(int val1, int val2, char oper, int &val3)
{
if (oper == '+')
val3 = val1 + val2;
else if (oper == '-')
val3 = val1 - val2;
else if (oper == '/')
val3 = val1 / val2;
else
val3 = val1 * val2;
}
void print(int num)
{
int j,i,v,x,l,c,d,m;
m = num / M;
num = num % M;
d = num / D;
num = num % D;
c = num / C;
num = num % C;
l = num / L;
num = num % L;
x = num / X;
num = num % X;
v = num / V;
num = num % V;
i = num / I;
num = num % I;
for (j=0;j<m;j++)
cout << "M";
for (j=0;j<d;j++)
cout << "D";
for (j=0;j<c;j++)
cout << "C";
for (j=0;j<l;j++)
cout << "L";
for (j=0;j<x;j++)
cout << "X";
for (j=0;j<v;j++)
cout << "V";
for (j=0;j<i;j++)
cout << "I";
}