# Thread: extracting value

1. ## extracting value

Hi ,
I have problem to extract the values from a loop. I will try to explain the problem:
I have a set of 15 cards. every hand is compose of 5 cards.

for each card I found the value of the card using a function that I have implemented.("two"=1, three=2.....king=12,..ace=13)

In the program when I read each line I printthe value of the card.
So my output is like this:

king of clubs
12
six of clubs
5
four of diamonds
3
six of hearts
5
four of hearts
3

Now I dont know how to store those values in an array called hand[].
For my output above my array should be:
12 5 3 5 3
Can I have some help?
thank you for your time
B

2. Well without seeing any code, it's tought to know exactly what you are looking for. The code below fills an array with integer values which might help you figure out what you need to do.
Code:
```int hand[5];
int i;
for(i = 0; i < 5; i++)
{
hand[i] = cardValue();
}```

3. Originally Posted by bithub
Well without seeing any code, it's tought to know exactly what you are looking for. The code below fills an array with integer values which might help you figure out what you need to do.
Code:
```int hand[5];
int i;
for(i = 0; i < 5; i++)
{
hand[i] = cardValue();
}```
The obective is that at the same time I read lines I need to store information with it.

This can help me thank you very much.
B.

Popular pages Recent additions