I'm new here and am just looking for some help. It would be greatly appreciated if someone could give me hint to help me with my project for simulating dialing a phone number. the part I need help on is the toDigit() function. In the toDigit() function I have to pass the variables by reference and if the its a letter that was inputted, lowercase has to be made to upper case and if the digit is valid return 0 or if the digit is invalid return -1. thanks for any help or hints!
switch (d)
{
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': returnValue = 0; break;
case 'A': case 'B': case 'C': d = 2; break;
case 'D': case 'E': case 'F': d = 3; break;
case 'G': case 'H': case 'I': d = 4; break;
case 'J': case 'K': case 'L': d = 5; break;
case 'M': case 'N': case 'O': d = 6; break;
case 'P': case 'Q': case 'R': case 'S': d = 7; break;
case 'T': case 'U': case 'V': d = 8; break;
case 'W': case 'X': case 'Y': case 'Z': d = 9; break;
default: returnValue = -1;
}
return 0;
}
When I input letters as the number the end results show the same letters I entered. For example if I enter: abc-devg, it will say the number dialed is: abc-devg.