: I am a freshman in high school and new to pascal. for school we have to make a program that reads what character on the phone pad a user enters and writes what that character would be as a number, like B would be 1, so on...........can someone plz help im no good with case statements
Here's a somewhat similar example that you should be able to adapt:
Ch := ReadKey;
case UpCase(Ch) of
// Matches any characters between 0 and 9
'0'..'9': WriteLn('Numeral');
// Matches only the characters supplied
'A', 'E', 'I', 'O', 'U': WriteLn('Vowel');
// Matches anything that isn't matched above
else
WriteLn('Consonant');
end;
BTW, unless you live in another country where your phones are different, the 1 button doesn't have any letters associated with it. So the B actually corresponds to the 2 button. Might want to double check that before you write any code :)