Storing info for cards

Discussion in 'C Programming' started by Radith, Aug 10, 2005.

  1. Radith

    Radith Guest

    Hi All,

    I have got this task which I cant get my head around:
    It asks how I would store information:
    I just want to get an opinion from the group:
    So here's the question:

    "
    You have been asked to write a program for a card playing friend. How
    would you store information about playing cards? For example how would
    you store the fact that a certain card is the 7 of diamonds? (You may
    use more than one variable if you wish)
    "

    All help welcome.
    Thanks in advance.

    Radith
    Radith, Aug 10, 2005
    #1
    1. Advertising

  2. Radith

    Mike Wahler Guest

    "Radith" <> wrote in message
    news:...
    > Hi All,
    >
    > I have got this task which I cant get my head around:
    > It asks how I would store information:
    > I just want to get an opinion from the group:
    > So here's the question:
    >
    > "
    > You have been asked to write a program for a card playing friend. How
    > would you store information about playing cards? For example how would
    > you store the fact that a certain card is the 7 of diamonds? (You may
    > use more than one variable if you wish)
    > "
    >
    > All help welcome.
    > Thanks in advance.
    >
    > Radith


    enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    enum faces {ACE = 1, JACK = 11, QUEEN, KING};

    struct card
    {
    unsigned int rank;
    unsigned char suit;
    };

    card c = {7, DIAMONDS};


    -Mike
    Mike Wahler, Aug 10, 2005
    #2
    1. Advertising

  3. Mike Wahler wrote:
    > "Radith" <> wrote in message
    > news:...
    > > Hi All,
    > >
    > > I have got this task which I cant get my head around:
    > > It asks how I would store information:
    > > I just want to get an opinion from the group:
    > > So here's the question:
    > >
    > > "
    > > You have been asked to write a program for a card playing friend. How
    > > would you store information about playing cards? For example how would
    > > you store the fact that a certain card is the 7 of diamonds? (You may
    > > use more than one variable if you wish)
    > > "
    > >
    > > All help welcome.
    > > Thanks in advance.
    > >
    > > Radith

    >
    > enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    > enum faces {ACE = 1, JACK = 11, QUEEN, KING};
    >
    > struct card
    > {
    > unsigned int rank;
    > unsigned char suit;
    > };
    >
    > card c = {7, DIAMONDS};


    struct card c = {7, DIAMONDS);

    Robert Gamble
    Robert Gamble, Aug 10, 2005
    #3
  4. Radith

    John Doe Guest

    In article <>,
    says...
    > Mike Wahler wrote:
    > > "Radith" <> wrote in message
    > > news:...
    > > > Hi All,
    > > >
    > > > I have got this task which I cant get my head around:
    > > > It asks how I would store information:
    > > > I just want to get an opinion from the group:
    > > > So here's the question:
    > > >
    > > > "
    > > > You have been asked to write a program for a card playing friend. How
    > > > would you store information about playing cards? For example how would
    > > > you store the fact that a certain card is the 7 of diamonds? (You may
    > > > use more than one variable if you wish)
    > > > "
    > > >
    > > > All help welcome.
    > > > Thanks in advance.
    > > >
    > > > Radith

    > >
    > > enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    > > enum faces {ACE = 1, JACK = 11, QUEEN, KING};
    > >
    > > struct card
    > > {
    > > unsigned int rank;
    > > unsigned char suit;
    > > };
    > >
    > > card c = {7, DIAMONDS};

    >
    > struct card c = {7, DIAMONDS);
    >
    > Robert Gamble
    >
    >

    struct card c = {7, DIAMONDS};

    If you're gonna be a nit-picky smart-ass, you better be correct.
    John Doe, Aug 10, 2005
    #4
  5. On 9 Aug 2005 18:00:41 -0700, "Radith" <> wrote:

    >Hi All,
    >
    >I have got this task which I cant get my head around:
    >It asks how I would store information:
    >I just want to get an opinion from the group:
    >So here's the question:
    >
    >"
    >You have been asked to write a program for a card playing friend. How
    >would you store information about playing cards? For example how would
    >you store the fact that a certain card is the 7 of diamonds? (You may
    >use more than one variable if you wish)
    >"


    You have lots of options. Just to start you off consider a struct
    with two members or a 2D array of char.


    <<Remove the del for email>>
    Barry Schwarz, Aug 10, 2005
    #5
  6. John Doe wrote:
    > In article <>,
    > says...
    > > Mike Wahler wrote:
    > > > "Radith" <> wrote in message
    > > > news:...
    > > > > Hi All,
    > > > >
    > > > > I have got this task which I cant get my head around:
    > > > > It asks how I would store information:
    > > > > I just want to get an opinion from the group:
    > > > > So here's the question:
    > > > >
    > > > > "
    > > > > You have been asked to write a program for a card playing friend. How
    > > > > would you store information about playing cards? For example how would
    > > > > you store the fact that a certain card is the 7 of diamonds? (You may
    > > > > use more than one variable if you wish)
    > > > > "
    > > > >
    > > > > All help welcome.
    > > > > Thanks in advance.
    > > > >
    > > > > Radith
    > > >
    > > > enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    > > > enum faces {ACE = 1, JACK = 11, QUEEN, KING};
    > > >
    > > > struct card
    > > > {
    > > > unsigned int rank;
    > > > unsigned char suit;
    > > > };
    > > >
    > > > card c = {7, DIAMONDS};

    > >
    > > struct card c = {7, DIAMONDS);
    > >
    > > Robert Gamble
    > >
    > >

    > struct card c = {7, DIAMONDS};


    Obviously that was an attempt to keep true to the tradition that any
    post correcting a grammatical (or syntactical) error must introduce one
    of it's own ;)

    Robert Gamble
    Robert Gamble, Aug 10, 2005
    #6
  7. In article <vvcKe.3711$>,
    Mike Wahler <> wrote:
    >enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    >enum faces {ACE = 1, JACK = 11, QUEEN, KING};


    >struct card
    >{
    > unsigned int rank;
    > unsigned char suit;
    >};


    >card c = {7, DIAMONDS};


    Mike, is there any particular reason you used int for rank when
    you only used char for suit? The minimum size for char has
    enough range to cover the largest possible card rank, which would
    tend to suggest something like using char for each of
    the elements.


    For that matter, if space is more important than efficiency, then

    struct card
    {
    unsigned char rank: 5;
    unsigned char suit: 3;
    }

    or perhaps


    #define rank_of(card) (((card)&0x1e)>>1)
    #define suit_of(card) (((card)&0xe1)>>5)
    #define is_face_up(card) ((card)&1)
    #define build_card(rank,suit,faceup) ((suit)<<5 | ((rank)<<1) | (faceup))

    typedef unsigned char card;


    Mind you, I wouldn't recommend this latter implementation to anyone who
    doesn't understand why the symmetry of the bitmasks is important
    in rank_of() and suit_of().
    --
    "This was a Golden Age, a time of high adventure, rich living and
    hard dying... but nobody thought so." -- Alfred Bester, TSMD
    Walter Roberson, Aug 10, 2005
    #7
  8. "Robert Gamble" <> writes:
    [...]
    > Obviously that was an attempt to keep true to the tradition that any
    > post correcting a grammatical (or syntactical) error must introduce one
    > of it's own ;)


    Shouldn't that be "its'"?

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
    Keith Thompson, Aug 10, 2005
    #8
  9. Walter Roberson wrote:
    > In article <vvcKe.3711$>,
    > #define rank_of(card) (((card)&0x1e)>>1)
    > #define suit_of(card) (((card)&0xe1)>>5)
    > #define is_face_up(card) ((card)&1)
    > #define build_card(rank,suit,faceup) ((suit)<<5 | ((rank)<<1) | (faceup))
    >
    > typedef unsigned char card;
    >
    >
    > Mind you, I wouldn't recommend this latter implementation to anyone who
    > doesn't understand why the symmetry of the bitmasks is important
    > in rank_of() and suit_of().


    Ok, you wouldn't recommend this implementation to me, cause I can't see
    why the symmetry of the two bitmasks is so important.

    Correct me if I'm wrong, but

    #define suit_of(card) (((card)&0xe0)>>5)

    would produce exactly the same result in every situation.
    Antonio Contreras, Aug 10, 2005
    #9
  10. Radith

    pete Guest

    Radith wrote:
    >
    > Hi All,
    >
    > I have got this task which I cant get my head around:
    > It asks how I would store information:
    > I just want to get an opinion from the group:
    > So here's the question:
    >
    > "
    > You have been asked to write a program for a card playing friend. How
    > would you store information about playing cards? For example how would
    > you store the fact that a certain card is the 7 of diamonds? (You may
    > use more than one variable if you wish)


    /* BEGIN shuffle.c */

    #include <stdio.h>
    #include <time.h>

    #define LU_RAND_SEED 123456789LU
    #define LU_RAND(S) ((S) * 69069 + 362437 & 0xffffffffLU)
    #define SUITS (sizeof suit / sizeof *suit)
    #define RANKS (sizeof rank / sizeof *rank)
    #define CARDS (SUITS * RANKS)
    #define HAND 5
    #define DEALS 5

    struct poker {
    int suit;
    int rank;
    };

    long unsigned shuffle(int *, int, long unsigned);
    int compar_rank(void const*, void const*);
    int compar_suit(void const*, void const*);
    int straight(struct poker *);
    int pair(struct poker *);
    int flush(struct poker *);
    int three(struct poker *);
    int four(struct poker *);
    int full(struct poker *);
    int two_pair(struct poker *);
    void s_sort(void *base, size_t nmemb, size_t size,
    int (*compar)(const void *, const void *));

    int main(void)
    {
    size_t card;
    struct poker hand[HAND];
    long unsigned deal;
    long unsigned seed = LU_RAND_SEED;
    char *suit[] = {"Hearts","Diamonds","Clubs","Spades"};
    char *rank[] = {"Deuce","Three","Four","Five","Six",
    "Seven","Eight","Nine","Ten","Jack","Queen","King","Ace"
    };
    int deck[CARDS];

    putchar('\n');
    /**/
    seed = (long unsigned)time(0);
    /*//**/
    deal = DEALS;
    while (deal-- != 0) {
    seed = shuffle(deck, CARDS, seed);
    for (card = 0; card != HAND; ++card) {
    hand[card].suit = deck[card] % SUITS;
    hand[card].rank = deck[card] % RANKS;
    }
    if (pair(hand)) {
    if (three(hand)) {
    if (four(hand)) {
    puts("Four of a Kind:");
    } else {
    if (full(hand)) {
    puts("Full House:");
    } else {
    puts("Three of a Kind:");
    }
    }
    } else {
    if (two_pair(hand)) {
    puts("Two Pair:");
    } else {
    puts("Pair:");
    }
    }
    } else {
    switch (2 * flush(hand) + straight(hand)) {
    case 0:
    s_sort(hand, HAND, sizeof *hand, compar_rank);
    printf("%s High:\n", rank[hand[4].rank]);
    break;
    case 1:
    puts("Straight:");
    break;
    case 2:
    puts("Flush:");
    break;
    default:
    puts("Straight Flush:");
    break;
    }
    }
    putchar('\n');
    for (card = 0; card != HAND; ++card) {
    printf("%s of %s\n",
    rank[deck[card] % RANKS],
    suit[deck[card] % SUITS]);
    }
    putchar('\n');
    }
    return 0;
    }

    int pair(struct poker *hand)
    {
    s_sort(hand, HAND, sizeof *hand, compar_rank);
    return hand[1].rank == hand[0].rank
    || hand[2].rank == hand[1].rank
    || hand[3].rank == hand[2].rank
    || hand[4].rank == hand[3].rank;
    }

    int three(struct poker *hand)
    {
    s_sort(hand, HAND, sizeof *hand, compar_rank);
    return hand[0].rank == hand[2].rank
    || hand[1].rank == hand[3].rank
    || hand[2].rank == hand[4].rank;
    }

    int four(struct poker *hand)
    {
    s_sort(hand, HAND, sizeof *hand, compar_rank);
    return hand[0].rank == hand[3].rank
    || hand[1].rank == hand[4].rank;
    }

    int full(struct poker *hand)
    {
    s_sort(hand, HAND, sizeof *hand, compar_rank);
    return hand[1].rank == hand[0].rank
    && hand[4].rank == hand[3].rank
    &&(hand[2].rank == hand[1].rank
    || hand[3].rank == hand[2].rank);
    }

    int two_pair(struct poker *hand)
    {
    s_sort(hand, HAND, sizeof *hand, compar_rank);
    return hand[1].rank == hand[0].rank
    && hand[2].rank == hand[3].rank
    || hand[1].rank == hand[0].rank
    && hand[4].rank == hand[3].rank
    || hand[1].rank == hand[2].rank
    && hand[4].rank == hand[3].rank;
    }

    int straight(struct poker *hand)
    {
    s_sort(hand, HAND, sizeof *hand, compar_rank);
    return hand[4].rank == hand[3].rank + 1
    && hand[3].rank == hand[2].rank + 1
    && hand[2].rank == hand[1].rank + 1
    &&(hand[1].rank == hand[0].rank + 1
    || hand[1].rank == 0 && hand[0].rank == 12);
    }

    int flush(struct poker *hand)
    {
    s_sort(hand, HAND, sizeof *hand, compar_suit);
    return hand[0].suit == hand[4].suit;
    }

    int compar_rank(void const *first, void const *second)
    {
    int int_1 = (*(struct poker*)first).rank;
    int int_2 = (*(struct poker*)second).rank;

    return int_2 > int_1 ? -1 : int_2 != int_1;
    }

    int compar_suit(void const *first, void const *second)
    {
    int int_1 = (*(struct poker*)first).suit;
    int int_2 = (*(struct poker*)second).suit;

    return int_2 > int_1 ? -1 : int_2 != int_1;
    }

    long unsigned shuffle(int *array, int n, long unsigned seed)
    {
    int i, r;

    array[0] = 0;
    for (i = 1; n > i; ++i) {
    seed = LU_RAND(seed);
    r = seed % (i + 1);
    array = 0;
    array = array[r];
    array[r] = i;
    }
    return seed;
    }

    void s_sort(void *base, size_t nmemb, size_t size,
    int (*compar)(const void *, const void *))
    {
    size_t bytes;
    unsigned char *array, *after, *i, *j, *k, *p1, *p2, *end, swap;

    array = base;
    after = nmemb * size + array;
    if (nmemb > (size_t)-1 / 3 - 1) {
    nmemb = nmemb / 3 - 1;
    } else {
    nmemb = (nmemb * 3 + 1) / 7;
    }
    while (nmemb != 0) {
    bytes = nmemb * size;
    i = bytes + array;
    do {
    j = i - bytes;
    if (compar(j, i) > 0) {
    k = i;
    do {
    p1 = j;
    p2 = k;
    end = p2 + size;
    do {
    swap = *p1;
    *p1++ = *p2;
    *p2++ = swap;
    } while (p2 != end);
    if (bytes + array > j) {
    break;
    }
    k = j;
    j -= bytes;
    } while (compar(j, k) > 0);
    }
    i += size;
    } while (i != after);
    nmemb = (nmemb * 3 + 1) / 7;
    }
    }

    /* END shuffle.c */


    --
    pete
    pete, Aug 10, 2005
    #10
  11. Radith

    Netocrat Guest

    On Wed, 10 Aug 2005 10:07:48 +0000, pete wrote:

    > /* BEGIN shuffle.c */

    <snip poker hand source code>
    > /* END shuffle.c */


    Neat pete. Yours? Used in?

    --
    http://members.dodo.com.au/~netocrat
    Netocrat, Aug 10, 2005
    #11
  12. Radith

    Mike Wahler Guest

    "Robert Gamble" <> wrote in message
    news:...
    > Mike Wahler wrote:
    >> struct card
    >> {
    >> unsigned int rank;
    >> unsigned char suit;
    >> };
    >>
    >> card c = {7, DIAMONDS};

    >
    > struct card c = {7, DIAMONDS);


    Oops, my C++ is showing. :)

    Thanks for the correction.

    -Mike
    Mike Wahler, Aug 10, 2005
    #12
  13. Radith

    Mike Wahler Guest

    "John Doe" <> wrote in message
    news:...
    > In article <>,
    > says...
    >> Mike Wahler wrote:
    >> > "Radith" <> wrote in message
    >> > news:...
    >> > > Hi All,
    >> > >
    >> > > I have got this task which I cant get my head around:
    >> > > It asks how I would store information:
    >> > > I just want to get an opinion from the group:
    >> > > So here's the question:
    >> > >
    >> > > "
    >> > > You have been asked to write a program for a card playing friend. How
    >> > > would you store information about playing cards? For example how
    >> > > would
    >> > > you store the fact that a certain card is the 7 of diamonds? (You may
    >> > > use more than one variable if you wish)
    >> > > "
    >> > >
    >> > > All help welcome.
    >> > > Thanks in advance.
    >> > >
    >> > > Radith
    >> >
    >> > enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    >> > enum faces {ACE = 1, JACK = 11, QUEEN, KING};
    >> >
    >> > struct card
    >> > {
    >> > unsigned int rank;
    >> > unsigned char suit;
    >> > };
    >> >
    >> > card c = {7, DIAMONDS};

    >>
    >> struct card c = {7, DIAMONDS);
    >>
    >> Robert Gamble
    >>
    >>

    > struct card c = {7, DIAMONDS};
    >
    > If you're gonna be a nit-picky smart-ass, you better be correct.


    Well, that was my error (see my original post).
    I suspect Robert just copy-pasted and inserted
    the 'struct' keyword. But imo he got the message
    across.

    -Mike
    Mike Wahler, Aug 10, 2005
    #13
  14. Radith

    Mike Wahler Guest

    "Robert Gamble" <> wrote in message
    news:...
    > John Doe wrote:
    >> In article <>,
    >> says...
    >> > Mike Wahler wrote:
    >> > > "Radith" <> wrote in message
    >> > > news:...
    >> > > > Hi All,
    >> > > >
    >> > > > I have got this task which I cant get my head around:
    >> > > > It asks how I would store information:
    >> > > > I just want to get an opinion from the group:
    >> > > > So here's the question:
    >> > > >
    >> > > > "
    >> > > > You have been asked to write a program for a card playing friend.
    >> > > > How
    >> > > > would you store information about playing cards? For example how
    >> > > > would
    >> > > > you store the fact that a certain card is the 7 of diamonds? (You
    >> > > > may
    >> > > > use more than one variable if you wish)
    >> > > > "
    >> > > >
    >> > > > All help welcome.
    >> > > > Thanks in advance.
    >> > > >
    >> > > > Radith
    >> > >
    >> > > enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    >> > > enum faces {ACE = 1, JACK = 11, QUEEN, KING};
    >> > >
    >> > > struct card
    >> > > {
    >> > > unsigned int rank;
    >> > > unsigned char suit;
    >> > > };
    >> > >
    >> > > card c = {7, DIAMONDS};
    >> >
    >> > struct card c = {7, DIAMONDS);
    >> >
    >> > Robert Gamble
    >> >
    >> >

    >> struct card c = {7, DIAMONDS};

    >
    > Obviously that was an attempt to keep true to the tradition that any
    > post correcting a grammatical (or syntactical) error must introduce one
    > of it's own ;)


    But it didn't. It was there already. However your post
    does have a punctuation error. :)

    -Mike
    Mike Wahler, Aug 10, 2005
    #14
  15. Radith

    Mike Wahler Guest

    "Walter Roberson" <-cnrc.gc.ca> wrote in message
    news:ddbqpe$pju$...
    > In article <vvcKe.3711$>,
    > Mike Wahler <> wrote:
    >>enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    >>enum faces {ACE = 1, JACK = 11, QUEEN, KING};

    >
    >>struct card
    >>{
    >> unsigned int rank;
    >> unsigned char suit;
    >>};

    >
    >>card c = {7, DIAMONDS};

    >
    > Mike, is there any particular reason you used int for rank
    > you only used char for suit?


    Midcourse design change. :) I originally was going to
    use characters (e.g. 'C', 'H', 'D', 'S') for the suit,
    but then went with the enum. Didn't even think to change
    the type.

    > The minimum size for char has
    > enough range to cover the largest possible card rank, which would
    > tend to suggest something like using char for each of
    > the elements.


    Right.

    >
    >
    > For that matter, if space is more important than efficiency, then


    I wasn't concerned with 'efficiency' of any sort, only
    demonstrating a data structure

    -Mike
    Mike Wahler, Aug 10, 2005
    #15
  16. Radith

    Thad Smith Guest

    Walter Roberson wrote:

    > #define rank_of(card) (((card)&0x1e)>>1)
    > #define suit_of(card) (((card)&0xe1)>>5)
    > #define is_face_up(card) ((card)&1)
    > #define build_card(rank,suit,faceup) ((suit)<<5 | ((rank)<<1) | (faceup))
    >
    > typedef unsigned char card;
    >
    >
    > Mind you, I wouldn't recommend this latter implementation to anyone who
    > doesn't understand why the symmetry of the bitmasks is important
    > in rank_of() and suit_of().


    I'll bite -- what advantage would there be to having the symmetrical bit
    masks?

    Thad
    Thad Smith, Aug 10, 2005
    #16
  17. Mike Wahler wrote:
    > "Robert Gamble" <> wrote in message
    > news:...
    > > John Doe wrote:
    > >> In article <>,
    > >> says...
    > >> > Mike Wahler wrote:
    > >> > > "Radith" <> wrote in message
    > >> > > news:...
    > >> > > > Hi All,
    > >> > > >
    > >> > > > I have got this task which I cant get my head around:
    > >> > > > It asks how I would store information:
    > >> > > > I just want to get an opinion from the group:
    > >> > > > So here's the question:
    > >> > > >
    > >> > > > "
    > >> > > > You have been asked to write a program for a card playing friend.
    > >> > > > How
    > >> > > > would you store information about playing cards? For example how
    > >> > > > would
    > >> > > > you store the fact that a certain card is the 7 of diamonds? (You
    > >> > > > may
    > >> > > > use more than one variable if you wish)
    > >> > > > "
    > >> > > >
    > >> > > > All help welcome.
    > >> > > > Thanks in advance.
    > >> > > >
    > >> > > > Radith
    > >> > >
    > >> > > enum suits {CLUBS, HEARTS, DIAMONDS, SPADES};
    > >> > > enum faces {ACE = 1, JACK = 11, QUEEN, KING};
    > >> > >
    > >> > > struct card
    > >> > > {
    > >> > > unsigned int rank;
    > >> > > unsigned char suit;
    > >> > > };
    > >> > >
    > >> > > card c = {7, DIAMONDS};
    > >> >
    > >> > struct card c = {7, DIAMONDS);
    > >> >
    > >> > Robert Gamble
    > >> >
    > >> >
    > >> struct card c = {7, DIAMONDS};

    > >
    > > Obviously that was an attempt to keep true to the tradition that any
    > > post correcting a grammatical (or syntactical) error must introduce one
    > > of it's own ;)

    >
    > But it didn't. It was there already.


    Your original post had a closed-curly bracket, not a parenthesis.

    > However your post does have a punctuation error. :)


    The emoticon is serving as puncutation, the grammatical error was the
    fact that "it's" should have been "its". Keith pointed this out but
    his correction, in keeping with tradition I'm sure, was incorrect.

    Robert Gamble
    Robert Gamble, Aug 10, 2005
    #17
  18. Radith

    Mike Wahler Guest

    "Robert Gamble" <> wrote in message
    news:...
    > Mike Wahler wrote:


    >> > Obviously that was an attempt to keep true to the tradition that any
    >> > post correcting a grammatical (or syntactical) error must introduce one
    >> > of it's own ;)

    >>
    >> But it didn't. It was there already.

    >
    > Your original post had a closed-curly bracket, not a parenthesis.


    Sorry, my mistake.

    >
    >> However your post does have a punctuation error. :)

    >
    > The emoticon is serving as puncutation, the grammatical error was the
    > fact that "it's" should have been "its".


    You're calling that a grammatical error, I called it
    a punctuation error.

    > Keith pointed this out but
    > his correction, in keeping with tradition I'm sure, was incorrect.


    His correction of your incorrect use of "it's" was correct. The
    apostrophe is only used with "'it" to form the contraction for
    "it is". The possessive does not use the apostrophe.

    -Mike
    Mike Wahler, Aug 10, 2005
    #18
  19. Mike Wahler wrote:
    > "Robert Gamble" <> wrote in message
    > news:...
    > > Mike Wahler wrote:

    >
    > >> > Obviously that was an attempt to keep true to the tradition that any
    > >> > post correcting a grammatical (or syntactical) error must introduce one
    > >> > of it's own ;)
    > >>
    > >> But it didn't. It was there already.

    > >
    > > Your original post had a closed-curly bracket, not a parenthesis.

    >
    > Sorry, my mistake.
    >
    > >
    > >> However your post does have a punctuation error. :)

    > >
    > > The emoticon is serving as puncutation, the grammatical error was the
    > > fact that "it's" should have been "its".

    >
    > You're calling that a grammatical error, I called it
    > a punctuation error.
    >
    > > Keith pointed this out but
    > > his correction, in keeping with tradition I'm sure, was incorrect.

    >
    > His correction of your incorrect use of "it's" was correct. The
    > apostrophe is only used with "'it" to form the contraction for
    > "it is". The possessive does not use the apostrophe.



    Precisely. Keith answer was:

    Shouldn't that be "its'"?

    Can't you see the little apostrophe after "its"? That single character
    makes his answer incorrect. :p
    Antonio Contreras, Aug 10, 2005
    #19
  20. Radith

    Old Wolf Guest

    Mike Wahler wrote:
    > Robert Gamble wrote:
    >> Mike Wahler wrote:

    >
    >>>> Obviously that was an attempt to keep true to the tradition that any
    >>>> post correcting a grammatical (or syntactical) error must introduce one
    >>>> of it's own ;)

    >>
    >>> However your post does have a punctuation error. :)

    >>
    >> The emoticon is serving as puncutation, the grammatical error was the
    >> fact that "it's" should have been "its".

    >
    > You're calling that a grammatical error, I called it
    > a punctuation error.
    >
    > > Keith pointed this out but
    > > his correction, in keeping with tradition I'm sure, was incorrect.

    >
    > His correction of your incorrect use of "it's" was correct. The
    > apostrophe is only used with "'it" to form the contraction for
    > "it is". The possessive does not use the apostrophe.


    Your correction of his Robert's observation of Keith's correction
    of Robert's incorrect usage seems to be incorrect. :)

    Keith wrote that it should be " its' " (note the trailing
    apostrophe), which is incorrect (not correct, as you said).
    However you correctly pointed out that the possessive of "it"
    does not use an apostrophe at all. In fact it is the
    only English word that has this property.
    Old Wolf, Aug 10, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Paugh
    Replies:
    0
    Views:
    399
    Jon Paugh
    Jan 22, 2004
  2. Firewalker

    Storing an object info

    Firewalker, Jul 15, 2004, in forum: Java
    Replies:
    4
    Views:
    407
  3. abraxas
    Replies:
    0
    Views:
    333
    abraxas
    Aug 3, 2006
  4. toton
    Replies:
    11
    Views:
    709
    toton
    Oct 13, 2006
  5. Jonathan Wood
    Replies:
    1
    Views:
    508
    Jonathan Wood
    Jun 2, 2008
Loading...

Share This Page