I want it to read 5 cards then display a text value, any idea why is does do that?
Code:
#include <stdio.h>
int main( void )
{
char inputtedhand[25];
int index, i, m;
int text;
int tempvar;
char tempsuit;
int cardvalue[5];
int cardtext[5];
char cardsuit[5];
scanf( "%d", inputtedhand[25]);
for( index==1; index<=5; index++)
/* This is going to count up from 1 through to 5, fo we can read all the 4 card in the hand */
{
for(i==0; i<=12; i+=3)
/* This loop will be counting in multiples of 3, starting at 0, it is used so we can locate specific places within the array*/
{
scanf("%d", inputtedhand[i]);
if ("%d",inputtedhand[i]==2)
{
printf( "The two of");
tempvar=2;
}
else if (inputtedhand[i]==3)
{
printf( "the three of");
tempvar=3;
}
else if (inputtedhand[i]==4)
{
printf("%c", "the four of");
tempvar=4;
}
else if (inputtedhand[i]==5)
{
printf("%c", "the five of");
tempvar=5;
}
else if (inputtedhand[i]==6)
{
printf("%c", "The six of");
tempvar=6;
}
else if (inputtedhand[i]==7)
{
printf("%c", "The seven of");
tempvar=7;
}
else if (inputtedhand[i]==8)
{
printf("%c", "The eight of");
tempvar=8;
}
else if (inputtedhand[i]==9)
{
printf("%c", "The nine of");
tempvar=9;
}
else if (inputtedhand[i]==0)
{
printf("%c", "The ten of");
tempvar=10;
}
else if (inputtedhand[i]=="J")
{
printf("%c", "the jack of");
tempvar=11;
}
else if (inputtedhand[i]=="Q")
{
printf("%c", "the queen of");
tempvar=12;
}
else if (inputtedhand[i]=="K")
{
printf("%c", "the king of");
tempvar=13;
}
else if (inputtedhand[i]=="A")
{
printf("%c", "the ace of");
tempvar=14;
}
else
{
printf("the value of the card is not recognised");
}
m=(i+1);
/* The card suit is always the nect character after the value, so 'm' will locate the suit for us */
scanf("&d", &inputtedhand[m]);
{
if (inputtedhand[m]=="C")
{
printf("%c", "Clubs\n");
}
else if (inputtedhand[m]="D")
{
printf("%c", "Diamonds\n");
}
else if (inputtedhand[m]="H")
{
printf("%c", " Hearts\n");
}
else if (inputtedhand[m]="S")
{
printf("%c", "Spades\n");
}
}
{
if (index=1)
{
cardvalue[index]=tempvar;
cardsuit[index]=tempsuit;
}
else if (index=2)
{
cardvalue[index]=tempvar;
cardsuit[index]=tempsuit;
}
else if (index=3)
{
cardvalue[index]=tempvar;
cardsuit[index]=tempsuit;
}
else if (index=4)
{
cardvalue[index]=tempvar;
cardsuit[index]=tempsuit;
}
else if (index=5)
{
cardvalue[index]=tempvar;
cardsuit[index]=tempsuit;
}
/* Here we stored the values we found for each card into an array, this is so we can perform the buble sort algorithm on it */
}
}
}