Created
February 14, 2017 01:37
-
-
Save miquilenadiego/e78cece81a75488c293f7ab8552b5f38 to your computer and use it in GitHub Desktop.
Receive a position from 0 to 52 and returns the ascii value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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