Making char the letter value instead of number value

I made a switch statement so if the variable is a number it'd make it a letter, but when I output the answer its the number value of the letter I made it. (at least I'm assuming thats where number is coming from.)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  switch (remainder){
            case 10:
               remainder = 'A';
               break;
            case 11:
               remainder = 'B';
               break;
            case 12:
               remainder = 'c';
               break;
            case 13:
               remainder = 'D';
               break;
            case 14:
               remainder = 'E';
               break;
            case 15:
               remainder = 'F';
               break;
         }


The number I've been using ends up with 15, changing it to 'F', then is output as 70.
@toast9

The ASCII value of 'F', is 70. You probably defined remainder as in int, so, when you assign that variable to a letter, it will take that and convert it to the ASCII value. You'll probably have to create another variable, of type char, to hold the remainder value.
Wait...so you want to output the remainder in the screen right?...can you paste the whole code?
I figured it out. I made a second variable as a char to hold the letter values and kept my first (remainder) for the number values.
Topic archived. No new replies allowed.