You are using '1','2'.....etc that's wrong because it's for the character...
For integer...
just write
1 2 3 4 5 6 7 8
case 1:
//cout your statement
break;
case 2:
//cout your statement
break;
...........................................
...........................................
Try to put your line: r = num / 10;
AFTER cin>>num;
You have it before, and if you do the division before receiving the user's input, num will have garbage data and the resulting value of r will be wrong.