I am new to programing and I was wondering if someone could help me understand why I am getting this error. Also the code works when it is in main, but not when I try to use it as a function call. Any other tips would be appreciated too.
void hex2Dec()
{
string hex;
getline(cin,hex);
double con[3];
double decimal;
cout << "Hex # " << hex << " was entered." << endl;
for (int n = 0; n < 4; n++)
{
if (int(hex[n] > 47 && int(hex[n]) < 58))
{
con[n] = (int(hex[n]) - 48) * pow(16, 3 - n);
}``
else (int(hex[n]) > 96 && int(hex[n]) < 122)
{
con[n] = (int(hex[n]) - 87) * pow(16, 3 - n);
}
}
decimal = con[0] + con[1] + con[2] + con[3];
cout << "The hex # " << hex << " = " << decimal << " in decimal." << endl;