How do you find the ASCII value of a character?
I got this much to work. It will print each character in the string with the ASCII value next to it. But how can I change it so the num variable is 65 less than the ASCII value so that A = 1, B = 2, etc? And how can I assign the ASCII value to the num variable? num = int(c) doesn't seem to work.
static void Main(string[] args)
{
string mystring = "hello";
int num;
mystring = mystring.ToUpper();
foreach(char c in mystring)
{
Console.Write("{0} - ",c);
//num = int(c) - 65; //doesn't work
Console.WriteLine(((int)c).ToString());
}
}

jcity444Rank #3,217 · 446 reputationPosted Jan 18, 2004, 8:54 AM EST
joy.simpsonRank #4,292 · 353 reputationPosted Jan 18, 2004, 11:15 AM EST
Tanvir HudaRank #4,089 · 366 reputationPosted Jan 18, 2004, 2:20 PM EST
Tanvir HudaRank #4,089 · 366 reputationPosted Jan 18, 2004, 2:38 PM EST
joy.simpsonRank #4,292 · 353 reputationPosted Jan 18, 2004, 6:45 PM EST