If you can assume ASCII or some other character set that guarantees that alphabetic characters are contiguous, then you could do something like this.
Code:
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
char line[80];
fputs("text? ", stdout);
fflush(stdout);
if ( fgets(line, sizeof line, stdin) != NULL )
{
int i;
char *newline = strchr(line, '\n');
if ( newline != NULL )
{
*newline = '\0';
}
for ( i = 0; line[i] != '\0'; ++i )
{
printf("%c %d\n", line[i], toupper(line[i]) - 'A' + 1);
}
}
return 0;
}
/* my output
text? Jane
J 10
a 1
n 14
e 5
*/