I am just wondering if there is a way to put the following code into a loop or two so that it is easier on the eyes and doesn't take us so many lines. I have not been able to think of a way to do this with so many different characters all equaling a different amount. By the way this is for a program that computes software code validity, and the program works fine as is, just trying to consolidate some code. I apologize for the wall of code here. Thank you for your help in advance.
for(int b = 0; b <= 19; b++)
{
if(softChar[b] == 'a')
{
alphaValue = 10;
}
else if(softChar[b] == 'b')
{
alphaValue = 11;
}
else if(softChar[b] == 'c')
{
alphaValue = 12;
}
else if(softChar[b] == 'd')
{
alphaValue = 13;
}
else if(softChar[b] == 'e')
{
alphaValue = 14;
}
else if(softChar[b] == 'f')
{
alphaValue = 15;
}
else if(softChar[b] == 'g')
{
alphaValue = 16;
}
else if(softChar[b] == 'h')
{
alphaValue = 17;
}
else if(softChar[b] == 'i')
{
alphaValue = 18;
}
else if(softChar[b] == 'j')
{
alphaValue = 19;
}
else if(softChar[b] == 'k')
{
alphaValue = 20;
}
else if(softChar[b] == 'l')
{
alphaValue = 21;
}
else if(softChar[b] == 'm')
{
alphaValue = 22;
}
else if(softChar[b] == 'n')
{
alphaValue = 23;
}
else if(softChar[b] == 'o')
{
alphaValue = 24;
}
else if(softChar[b] == 'p')
{
alphaValue = 25;
}
else if(softChar[b] == 'q')
{
alphaValue = 26;
}
else if(softChar[b] == 'r')
{
alphaValue = 27;
}
else if(softChar[b] == 's')
{
alphaValue = 28;
}
else if(softChar[b] == 't')
{
alphaValue = 29;
}
else if(softChar[b] == 'u')
{
alphaValue = 30;
}
else if(softChar[b] == 'v')
{
alphaValue = 31;
}
else if(softChar[b] == 'w')
{
alphaValue = 32;
}
else if(softChar[b] == 'x')
{
alphaValue = 33;
}
else if(softChar[b] == 'y')
{
alphaValue = 34;
}
else if(softChar[b] == 'z')
{
alphaValue = 35;
}
//*************CAPITAL LETTERS START HERE***************//
if(softChar[b] == 'A')
{
alphaValue = 36;
}
else if(softChar[b] == 'B')
{
alphaValue = 37;
}
else if(softChar[b] == 'C')
{
alphaValue = 38;
}
else if(softChar[b] == 'D')
{
alphaValue = 39;
}
else if(softChar[b] == 'E')
{
alphaValue = 40;
}
else if(softChar[b] == 'F')
{
alphaValue = 41;
}
else if(softChar[b] == 'G')
{
alphaValue = 42;
}
else if(softChar[b] == 'H')
{
alphaValue = 43;
}
else if(softChar[b] == 'I')
{
alphaValue = 44;
}
else if(softChar[b] == 'J')
{
alphaValue = 45;
}
else if(softChar[b] == 'K')
{
alphaValue = 46;
}
else if(softChar[b] == 'L')
{
alphaValue = 47;
}
else if(softChar[b] == 'M')
{
alphaValue = 48;
}
else if(softChar[b] == 'N')
{
alphaValue = 49;
}
else if(softChar[b] == 'O')
{
alphaValue = 50;
}
else if(softChar[b] == 'P')
{
alphaValue = 51;
}
else if(softChar[b] == 'Q')
{
alphaValue = 52;
}
else if(softChar[b] == 'R')
{
alphaValue = 53;
}
else if(softChar[b] == 'W')
{
alphaValue = 54;
}
else if(softChar[b] == 'T')
{
alphaValue = 55;
}
else if(softChar[b] == 'U')
{
alphaValue = 56;
}
else if(softChar[b] == 'V')
{
alphaValue = 57;
}
else if(softChar[b] == 'W')
{
alphaValue = 58;
}
else if(softChar[b] == 'X')
{
alphaValue = 59;
}
else if(softChar[b] == 'Y')
{
alphaValue = 60;
}
else if(softChar[b] == 'Z')
{
alphaValue = 61;
}
else
{
alphaValue = int(softChar[b]) - int('0');
}