jrliv
5/9/2017 - 2:41 AM

Prints the Unicode value of a character.

Prints the Unicode value of a character.

char ch = 'C';

Console.WriteLine("The value of '" + ch + "' is: " + (int)ch);
ch = 'o';
Console.WriteLine("The value of '" + ch + "' is: " + (int)ch);
ch = 'd';
Console.WriteLine("The value of '" + ch + "' is: " + (int)ch);
ch = 'e';
Console.WriteLine("The value of '" + ch + "' is: " + (int)ch);
ch = '!';
Console.WriteLine("The value of '" + ch + "' is: " + (int)ch);

//  The value of 'C' is: 67
//  The value of 'o' is: 111
//  The value of 'd' is: 100
//  The value of 'e' is: 101
//  The value of '!' is: 33