Skip to content

Instantly share code, notes, and snippets.

@miquilenadiego
Created February 14, 2017 01:37
Show Gist options
  • Save miquilenadiego/e78cece81a75488c293f7ab8552b5f38 to your computer and use it in GitHub Desktop.
Save miquilenadiego/e78cece81a75488c293f7ab8552b5f38 to your computer and use it in GitHub Desktop.
Receive a position from 0 to 52 and returns the ascii value
int toasci(int c)
{
int ascii;
if (c >= 0 && c <= 25)
{
ascii = 65;
int upper = 0;
while (upper < c)
{
ascii++;
upper++;
}
}
else
{
ascii = 97;
int lower = 26;
while (lower < c)
{
ascii++;
lower++;
}
}
return ascii;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment