User Profile

Collapse

Profile Sidebar

Collapse
JamC
JamC
Last Activity: Aug 5 '07, 03:46 AM
Joined: Apr 1 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • JamC
    replied to If else problem
    in C
    Getting back to the question
    You can use compound expression in if

    Code:
    Ex..
    
    if (age >= 0) 
       if (age < 120)
          print age is valid
    
    to
    
    if (age >= 0) && (age < 120)
      print age is valid
    =========================
    
    if (age < 0) || (age >= 120)
      print age is valid
    
    to
    
    if (age < 0)
    ...
    See more | Go to post

    Leave a comment:


  • JamC
    replied to Modifying my code...
    in C
    Well I think there is a miscommunicatio n here- I added functions but I don't want the user to choose Ace high or low- I want the function isStraight to handle it when I type in the values to test...
    I will add more functions/clean code up once I get the isStraight function to work correctly...

    Code:
    #include <iostream>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    ...
    See more | Go to post

    Leave a comment:


  • JamC
    replied to Modifying my code...
    in C
    Well almost- I created a test program- works for all straights except ace high..

    I have to use the flag modification- just not sure how to modify my- I have to set the flag now somewhere in function not sure where...

    Code:
    #include <iostream>
    #include <ctime>
    #include <cstdlib>
    #include <string>
    
    using namespace std;
    
      //const int SUITS = 4;
    ...
    See more | Go to post

    Leave a comment:


  • JamC
    replied to Modifying my code...
    in C
    OK

    When I think flag I think boolean...
    Not sure what to set HIGH too...then I would have to modify function...

    Here is what I fixed...

    Code:
    int numInRank[13];
    
    bool flag = true;   //flag to determine if Ace is high or low
    
    cin.get(rankCh);
        switch (toupper(rankCh))
         {         
          case '-1':            exit(0);
          case 'A':
    ...
    See more | Go to post

    Leave a comment:


  • JamC
    replied to help me in this program....
    in C
    How about something like...

    Code removed per Posting Guidelines
    See more | Go to post

    Leave a comment:


  • JamC
    replied to help!
    in C
    What is the program?
    See more | Go to post

    Leave a comment:


  • JamC
    started a topic Modifying my code...
    in C

    Modifying my code...

    I have a program evaluating a straight hand in poker: Here is my code:

    [code=cpp]
    cin.get(rankCh) ;
    switch (toupper(rankCh ))
    {
    case '-1': exit(0);
    case '?': rank = 0; break;
    case 'A': rank = 1; break;
    case '2': rank = 2; break;
    case '3': rank = 3; break;
    case '4': rank...
    See more | Go to post
    Last edited by sicarie; Jul 30 '07, 12:55 PM. Reason: Code tags are to the right when you start or reply to a post. Please use them.

  • JamC
    started a topic Problem with determining Straight code
    in Java

    Problem with determining Straight code

    Hi I have a poker program...

    My code for Pair, 2 pair etc work, except when I code for a straight hand

    When I separate the sort function like below I can get it...
    Code:
     public void straight()
       {
          int locations[] = new int[ 5 ], z = 0;
    
          for ( int y = 0; y < numbers.length; y++ )
    
             if ( numbers[ y ] == 1 )
                locations[ z++ ] = y;
    ...
    See more | Go to post
No activity results to display
Show More
Working...