1. redefinition of input

I am trying to make a poker scoring code and am struggling a bit with the 'picture cards'. The user inputs the hand
for example 3c 7d 9h js ad
I have worked out nearly all of the source code, except straights that include jack queen king ace.
Is there anyway that when a user types in J the code will recognize it as 11, then queen as 12, etc etc. So from there I could still use the same code I have already made. Thank you for your help.
Here is the part of my code that works out the straight.
Code:
```#include<stdio.h>
int main(void)
{   int c;
int n;
int count1[127] = {0};
int count2[127] = {0};
int count3 = {0};
int i;
int a;
int temp;
int j;
int difference;
char array[5];
char array1[5];
n = 5;

for (c = 0; c < n; c++)
scanf("%c%c ", &array1[c], &array[c]);
getchar();
for (i=0;i<n; i++)
{
for (i=0; i<4; i++)
{
for (j=i+1; j<5; j++)
{
if(array1[i] > array1[j]) {
temp = array1[i];
array1[i] = array1[j];
array1[j] = temp;
}
}
}

for(i=0;i<n-1;i++)
{
difference=(array1[i+1]-array1[i]);
{if ( difference == 1)
count3++;
}

}
if ( count3 == 4)
printf("Straight ");```

2. Code:
```         if(array1[i] > array1[j]) {
temp = array1[i];
array1[i] = array1[j];
array1[j] = temp;
}```
This only swaps the rank, not the suit.
So swapping 3c with 7d results in 7c and 3d

Use a struct to keep related data together.
Code:
```struct card {
char rank;
char suit;
};```
Then you can swap hand[i] and hand[j] (where hand is an array of card), using the method you have at the moment.

As for turning J into 11 etc, consider a separate function which reads a letter and returns a number.
Code:
```if ( ch == 'J' ) rank = 11;
// and so on.```

3. I understand what you have mentioned above and am working on correcting that. However I am a bit confused what you have wrote inside the if statment, ( ch == 'j' ). What is ch?

4. ch is the generic name (like foo) for the char you just read with scanf() or getchar()

5. I am so very close to finishing my programming but I still get the source to certain input from the user as different numbers. so when a user types in J the code will recognize it as 11, then queen as 12, etc etc. Any help will be greatly appreciated

6. Save yourself the headaches and make some conversion functions to repesent cards as integers. Example:

Code:
```int ch2rank(char chrank) {
switch(toupper(chrank)) {
case 'A': return 1;
case '1': return 1;
case '2': return 2;
case '3': return 3;
case '4': return 4;
case '5': return 5;
case '6': return 6;
case '7': return 7;
case '8': return 8;
case '9': return 9;
case '0': return 10;
case 'J': return 11;
case 'Q': return 12;
case 'K': return 13;
}
return 0;
}

int ch2suit(char chsuit) {
switch(toupper(chsuit)) {
case 'S': return 1;
case 'H': return 2;
case 'D': return 3;
case 'C': return 4;
}
return 0;
}```
How would you use the functions? Convert some characters into the appropriate values:

Code:
```printf("Enter a card in the format RS (R: rank, S: suit).\n");
char chrank, chsuit;
scanf(" %c %c", &chrank, &chsuit);
int rank = ch2rank(chrank);
int suit = ch2suit(chsuit);
printf("%c%c: --> (%d, %d)\n", chrank, chsuit, rank, suit);```
Simply repeat this process for all cards entered. For example, given the input 3c 7d 9h js ad, the output is:

3c: --> (3, 4)
7d: --> (7, 3)
9h: --> (9, 2)
js: --> (11, 1)