Thread: extracting value

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    39

    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. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    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. #3
    Registered User
    Join Date
    Jan 2006
    Posts
    39
    Quote 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 subscribe to a feed

Similar Threads

  1. Extracting info from a packet trace file
    By Ho ming in forum C Programming
    Replies: 1
    Last Post: 03-31-2008, 11:54 AM
  2. Extracting only file name from file path
    By President in forum C++ Programming
    Replies: 4
    Last Post: 03-01-2004, 10:51 PM
  3. Extracting specific parts from a string
    By (TNT) in forum C++ Programming
    Replies: 5
    Last Post: 07-10-2003, 06:43 PM
  4. extracting words from an array of words
    By axon in forum C++ Programming
    Replies: 2
    Last Post: 04-02-2003, 11:21 PM
  5. Extracting Rars
    By (TNT) in forum Windows Programming
    Replies: 1
    Last Post: 04-10-2002, 02:53 AM