The first question is easy. Simply have two parallel arrays, one of letters and one of values. If the letters go A-Z with no gap, you don't even need an actual array of letters, just access with values[ch - 'A'];
For the second question, you can write scratch code to handle this particular case. But really what you need to do is to define exactly what inputs are allowed (are they always pairs, always separated by a single space, are there always five pairs in a line?). Then you need to say what information you are getting, for example is a list of characters adequate, or do you need more structure?
An example function would be
Code:
/*
get first and second terms in list of values
Params: input - input in the form 3H 6S KH 7D AC
frist - return pointer for first values in pair
second - return pointer for second values in pair.
Returns: number of pairs parsed, -1 on error
*/
int parselist(const char *input, char *first, char *second)
{
/* logic goes here */
}
/*
Now to use it
*/
char *line = getinput();
char ch1[256];
char ch2[256];
int Nread;
int i;
Nread = parselist(line, ch1, ch2);
if(Nread <= 0)
/* error in input, handle here */
else
{
for(i=0;i<Nread;i++)
printf("Pair %d char one %c char two %c\n", i, ch1[i], ch2[i]);
}