The ultimate noob lol...plz help

This is a discussion on The ultimate noob lol...plz help within the C++ Programming forums, part of the General Programming Boards category; Ok so i've been doing the C++ thing for a week or two and am getting the hang of the ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    5

    The ultimate noob lol...plz help

    Ok so i've been doing the C++ thing for a week or two and am getting the hang of the basics...very basics.

    But i thought i would have enough grasp at this point to use what code i've learned with some common sense to build a small program that bascially just takes and input and gives an output...simple enough right. Well this is were i'm at at the moment and i can't for the life of me understand why it won't work. I'm using Dev-C++ 4.9.7.0 for anyone interested.

    Code:
    #include <iostream>
    #include <stdlib.h>
    #include <string>
    #include <math.h>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    
    { 
          int A = 16;   // the cards i'm currently working with
          int K = 14;      // will eventually use entire deck
          int Q = 13;
      
      
           cout << "Please Enter Your First Card, Ace(A) King(K) Queen(Q) and Press Enter" << endl;
     
    
      int cardone;
     
      string resultone;
    
      cin >> cardone;
    
      resultone = cardone == A ? "16" : "0";
    
      cout << resultone << endl;
     
    
      cout << "Please Enter Your Second Card, Ace(A) King(K) Queen
    
    (Q) and Press Enter" << endl;
      
      
     
      
      system( "PAUSE" );	
      return 0;
    }
    I don't understand why the "cin" doesn't change the effect of the bool?...for instance if you run this code and type in A for the "cin" it seems like that would take cardone's place inside the bool but it doesn't....any help would be greatly appreciated. Thanks ahead of time

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,801
    Code:
    #include <stdlib.h>
    #include <math.h>
    These are deprecated, you should be using these:
    Code:
    #include <cstdlib>
    #include <cmath>
    Code:
    system( "PAUSE" );
    A couple of cin.get() statements would be safer than relying on this.


    Quote Originally Posted by thatpkrguy
    I don't understand why the "cin" doesn't change the effect of the bool?
    What bool? There is an int and a string but no bool.


    Quote Originally Posted by thatpkrguy
    for instance if you run this code and type in A for the "cin" it seems like that would take cardone's place inside the bool but it doesn't
    As currently written, your input statement expects an integer to be entered. If you attempt enter in non-numeric input, such as an 'A', then the input stream (cin) will go into an error state. It looks like you should enter a numeric value and then resultone gets set to the text "16" if the number entered is equal to 16 or "0" otherwise. This text is then printed.

    What's the problem? What are you typing in at the prompts? What are you getting back as output? What do you believe you should be getting back as output?
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    There are few diffrent things I see that you need to work on.....First your reading in a letter into a int variable (cardOne)...if I am not mistaken this is going to store the ascii value of A not A.....next you trying to set a string to equal an integer.....not to sure what is going on there.....maybe try something like this.....

    Code:
    #include "stdafx.h"
    #include <iostream>
    #using <mscorlib.dll>
    
    using namespace System;
    using namespace std;
    
    int _tmain()
    {
    int A;
    int K;
    int Q;
    int cardOne;
    
    cout << "Please Enter Your First Card, Ace(A) King(K) Queen(Q) and Press Enter" << endl;
    cin >> cardOne;
    
    if (cardOne == A)
    {
          cout << "16" << endl;
    }
    else if (cardOne == K)
    {
         cout << "14" << endl;
    }
    else if (cardOne == Q)
    {
          cout << "13" << endl;
    }
    else 
    {
          cout << "Input is Invalid" << endl;
    }
    }
    This will not work as is but it should give you a good idea of what to do.....also look into a case statment.....
    Last edited by chadsxe; 11-08-2005 at 10:40 AM.

  4. #4
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    chadsxe, there are so many errors in that code I don't think it's even helpful as pseudo-code, especially to a beginner that won't be able to recognize the errors. Besides, that's not the issue the OP is having.

    thatpkrguy, you might want to read directly into the string, and then check to see if the string variable equals "A", "K", "Q", or "J" (not your variables A, K, or Q). If it doesn't equal any of the above, then it is probably a number that you can convert.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by Daved
    chadsxe, there are so many errors in that code I don't think it's even helpful as pseudo-code, especially to a beginner that won't be able to recognize the errors. Besides, that's not the issue the OP is having.

    True.....

    I updated the code above so that it will compile. If you did not notice I am bad at writing pseudo-code. I also am not to sure if what your saying is what he is looking for. I guess we will not know until he posts again.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    While you're changing your code, would you mind removing the non-standard managed stuff and initialize your variables, especially since you use them without ever setting their values. You can create an unmanaged blank project with pre-compiled headers off by selecting Win32 Console Application and checking the Empty Project option in the Application Settings tab of the new project wizard.

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    131
    Quote Originally Posted by Daved
    While you're changing your code, would you mind removing the non-standard managed stuff and initialize your variables, especially since you use them without ever setting their values. You can create an unmanaged blank project with pre-compiled headers off by selecting Win32 Console Application and checking the Empty Project option in the Application Settings tab of the new project wizard.

    Calm down....I am sorry if I am stepping on toes.........I never proclaimed my little code above to be perfect....I have just as much learning to do as the next guy.....as a matter of fact you just taught me something and for now on I will be sure to remove the managed parts......I still consider myself new at this and forget a lot of simple things......by the way what would you initalize those variables to....there ascii values?

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    7,319
    Don't worry, you didn't step on any toes (I wasn't upset, I was just letting you know). You tried to help, which was noble. Unfortunately sometimes newbies helping newbies leads to too much confusion, so when mistakes are made they should be pointed out. I'm glad you learned something from it.

    You can just initialize the variables the way the OP did: int A = 16; int K = 14;, etc. The cardone variable doesn't really need initialization since it is used almost immediately to get the value from cin, although setting it to 0 or something like that would make debugging easier if cin fails.

  9. #9
    Registered User
    Join Date
    Nov 2005
    Posts
    5
    OK first off thanks for the help so far...i've made the small changes like

    These are deprecated, you should be using these:

    Code:
    #include <cstdlib>
    #include <cmath>
    I'm also not quite sure what your refering to with this statement:
    A couple of cin.get() statements would be safer than relying on this.
    Should i be using:
    cin.get(cardone);
    instead of
    cin >> cardone; or am i wayyyy off.

    i also changed the
    "int cardone" to a "char cardone" and now it is working...but of course i'm still way off from what i actually want to happen. Here is what i have now and is working the way it should according to the computer, but isn't exactly what i'm looking for, i'll explain after this.

    Code:
    #include <iostream>
    #include <cstdlib>
    #include <string>
    #include <cmath>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    
    { 
          
      int A = 16;   // the cards i'm currently working with
      int K = 14;      // will eventually use entire deck
      int Q = 13;
      
      
      cout << "Please Enter Your First Card, Ace(A) King(K) Queen(Q) and Press Enter" << endl;
     
    
      char cardone;
      string resultoneA;
      string resultoneK;
      string resultoneQ;
      cin >> cardone;
      resultoneA = cardone == 'A' ? "16" : " ";
      resultoneK = cardone == 'K' ? "14" : " ";
      resultoneQ = cardone == 'Q' ? "13" : " "; 
     
    
      cout << "Please Enter Your Second Card, Ace(A) King(K) Queen(Q) and Press Enter" << endl;
      
      char cardtwo;
      string resulttwoA;
      string resulttwoK;
      string resulttwoQ;
      cin >> cardtwo;
      resulttwoA = cardtwo == 'A' ? "16" : " ";
      resulttwoK = cardtwo == 'K' ? "14" : " ";
      resulttwoQ = cardtwo == 'Q' ? "13" : " ";
     
      cout << "Add your two final results together" << endl;
      
      cout << resultoneA + resultoneK + resultoneQ + resulttwoA + resulttwoK + resulttwoQ << endl;
     
      
      system( "PAUSE" );	
      return 0;
    }
    Ok so when i compile and run this it...well kinda works. for instance when i put in A for an Ace it asks me for the second card then lets say i put in K for a King it will give me a final result that looks like this:16 14

    Now this isn't to bad but is there any way that i can change the 16 and 14 into actual intergers so that i can add them together for the person versus them having to add them in there head. I tried doing this:

    Code:
    char cardtwo;
    
      string resulttwoA;
    
      string resulttwoK;
    
      string resulttwoQ;
    
      cin >> cardtwo;
    
      resulttwoA = cardtwo == 'A' ? 16 : 0;
    
      resulttwoK = cardtwo == 'K' ? 14 : 0;
    
      resulttwoQ = cardtwo == 'Q' ? 13 : 0;
    But instead of getting an interger at the end i got some wierd symbols...instead of a 16 i would get an arrow pointing to the right, 14 would get me a music note, and 13 would get me nothing. So i'm not sure how to go from here.

    Any and all help as always is more than appreciated. Thanks

    The Noob

  10. #10
    Registered User
    Join Date
    Mar 2005
    Posts
    140
    make your result variables ints instead of strings

    Code:
      int resultoneA;
      int resultoneK;
      int resultoneQ;
    
      resultoneA = cardone == 'A' ? 16 : 0;
      resultoneK = cardone == 'K' ? 14 : 0;
      resultoneQ = cardone == 'Q' ? 13 : 0;
    do you really need 3 results variables for each card?
    only one will actually have a value, the rest will equal zero.

    there are many ways to get around this like
    -series of if else's
    -switch statement
    -define an array of cards mapping card -> value
    ....
    Last edited by spydoor; 11-09-2005 at 09:34 AM.

  11. #11
    Registered User
    Join Date
    Nov 2005
    Posts
    5
    Hurray...chaning the results to int instead of string made it work great...the program works now lol.....thanks for everyones help so far. I'll continue to try and increase the "coolness" of the program if you will as i continue on my C++ journey. Also i'm still curious about the cin.get() thing. I don't know how that works.

  12. #12
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,801
    Quote Originally Posted by thatpkrguy
    Also i'm still curious about the cin.get() thing. I don't know how that works.
    If you are refering to what I wrote, I meant that it in most cases it is better to make a call (or two) to cin.get()) at the end of your program rather than using a call to system("PAUSE"). Based on what you've shown, you would likely need two, the first will eat the newline from the prior cin >> call and the second will wait for you to press another newline before exiting the program.

    Using system("PAUSE") to pause your program will work in many cases provided you only intend to compile/run the program on a machine that has that available (this affects code portability)... you might not be able to simply copy the code to another computer and expect the resulting program to run as it did on the other computer for example. Calls to system are slow, for a program like yours however that doesn't matter much. This would be more of an issue where your program repeatedly made calls to system (in a loop perhaps). Unscrupulous persons could also replace the PAUSE program on your PC with some virus program and then when your code calls system("PAUSE") you would be unleashing the virus upon the computer.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  13. #13
    Registered User
    Join Date
    Nov 2005
    Posts
    5
    ok guys here is the program that i have...it is now technically Working...obv its not were i want it yet, but it'll get there over time.

    Code:
    #include <iostream>
    #include <cstdlib>
    #include <string>
    #include <cmath>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    
    { 
    
      
      cout << "First Card, Ace(a) King(k) Queen(q) Jack(j) Ten(t) Nine(9) ect.. and Press Enter" << endl;
      
      char cardone;
      int resultoneA;
      int resultoneK;
      int resultoneQ;
      int resultoneJ;
      int resultoneT;
      int resultone9;
      int resultone8;
      int resultone7;
      int resultone6;
      int resultone5;
      int resultone4;
      int resultone3;
      int resultone2;  
      cin >> cardone;
      resultoneA = cardone == 'a' ? 16 : 0;
      resultoneK = cardone == 'k' ? 14 : 0;
      resultoneQ = cardone == 'q' ? 13 : 0; 
      resultoneJ = cardone == 'j' ? 12 : 0; 
      resultoneT = cardone == 't' ? 11 : 0; 
      resultone9 = cardone == '9' ? 9 : 0; 
      resultone8 = cardone == '8' ? 8 : 0; 
      resultone7 = cardone == '7' ? 7 : 0; 
      resultone6 = cardone == '6' ? 6 : 0; 
      resultone5 = cardone == '5' ? 5 : 0; 
      resultone4 = cardone == '4' ? 4 : 0; 
      resultone3 = cardone == '3' ? 3 : 0; 
      resultone2 = cardone == '2' ? 2 : 0; 
      
      cout << " " << endl;
      cout << "Second Card, Ace(a) King(k) Queen(q) Jack(j) Ten(t) Nine(9) ect.. and Press Enter" << endl;
      cout << " " << endl;
      
      char cardtwo;
      int resulttwoA;
      int resulttwoK;
      int resulttwoQ;
      int resulttwoJ;
      int resulttwoT;
      int resulttwo9;
      int resulttwo8;
      int resulttwo7;
      int resulttwo6;
      int resulttwo5;
      int resulttwo4;
      int resulttwo3;
      int resulttwo2;  
      cin >> cardtwo;
      resulttwoA = cardtwo == 'a' ? 16 : 0;
      resulttwoK = cardtwo == 'k' ? 14 : 0;
      resulttwoQ = cardtwo == 'q' ? 13 : 0; 
      resulttwoJ = cardtwo == 'j' ? 12 : 0; 
      resulttwoT = cardtwo == 't' ? 11 : 0; 
      resulttwo9 = cardtwo == '9' ? 9 : 0; 
      resulttwo8 = cardtwo == '8' ? 8 : 0; 
      resulttwo7 = cardtwo == '7' ? 7 : 0; 
      resulttwo6 = cardtwo == '6' ? 6 : 0; 
      resulttwo5 = cardtwo == '5' ? 5 : 0; 
      resulttwo4 = cardtwo == '4' ? 4 : 0; 
      resulttwo3 = cardtwo == '3' ? 3 : 0; 
      resulttwo2 = cardtwo == '2' ? 2 : 0; 
      
      cout << " " << endl;
      cout << "Are your cards Paired yes(y) no(n)?" << endl;
      cout << " " << endl;
        
      char paired;
      int pairedresult;
      cin >> paired;
      pairedresult = paired == 'y' ? 10 : 0;
      
      cout << " " << endl;    
      cout << "Are your cards Suited yes(y) no(n)?" << endl;
      cout << " " << endl;
      
      char suited;
      int suitedresult;
      cin >> suited;
      suitedresult = suited == 'y' ? 4 : 0;
      
      cout << " " << endl;
      cout << "Are your cards connected (ie, next to each other in rank as with J10 or JQ etc.) (y),(n)" << endl;
      cout << " " << endl;
      
      char gap1;
      int gap1result;
      cin >> gap1;
      gap1result = gap1 == 'y' ? 3 : 0;
     
      cout << " " << endl;
      cout << "Are your cards single \"gapped\" (ie, Q10 or J9 etc.) (y),(n)" << endl;
      cout << " " << endl;
      
      char gap2;
      int gap2result;
      cin >> gap2;
      gap2result = gap2 == 'y' ? 2 : 0;
      
      cout << " " << endl;
      cout << "Are your cards double \"gapped\" (ie, AJ or Q9 etc.) (y),(n)" << endl;
      cout << " " << endl;
      
      char gap3;
      int gap3result;
      cin >> gap3;
      gap3result = gap3 == 'y' ? 1 : 0;
      
      cout << " " << endl;
      cout << "Are you in late position? (y),(n)" << endl;
      cout << " " << endl;
      
      char position;
      int positionresult;
      cin >> position;
      positionresult = position == 'y' ? 4 :0;
      
      cout << " " << endl;
      cout << "Call a bet with 30 points or more, and raise or call a raise with 34 points or more." << endl;
      cout << " " << endl;
      
        cout << resultoneA + resultoneK + resultoneQ + resultoneJ + resultoneT +
              resultone9 + resultone8 + resultone7 + resultone6 + resultone5 +
              resultone4 + resultone3 + resultone2 + 
              resulttwoA + resulttwoK + resulttwoQ + resulttwoJ + resulttwoT +
              resulttwo9 + resulttwo8 + resulttwo7 + resulttwo6 + resulttwo5 +
              resulttwo4 + resulttwo3 + resulttwo2 +
              pairedresult + 
              suitedresult + 
              gap1result + 
              gap2result + 
              gap3result + 
              positionresult << endl;
              
      
    
     
      
      system( "PAUSE" );	
      return 0;
    }


    I'm trying to figure out how to get it to skip certain steps once a certain question has been answered...for example when it askes:

    cout << "Are your cards Paired yes(y) no(n)?" << endl;

    If the answer to this is yes i would like it to skip all of the other questions expect for the last one because the answer is obv going to be no for the rest...i tried doing this with a while loop and the program just wasn't havin it lol...any ideas would be appreciated.

    And thanks for all the help that has gotten me this far
    Last edited by thatpkrguy; 11-10-2005 at 03:00 PM. Reason: typo in code...

  14. #14
    Registered User
    Join Date
    Mar 2005
    Posts
    140
    That's an interesting program you're working on.

    I've made some changes you might be interested in. There is still a lot of room for improvement.

    Here's one way to start simplifing things. You don't need so many different variables when only one will store a meaningful value... the rest being zero.

    Code:
    #include <iostream>
    #include <cstdlib>
    #include <string>
    #include <cmath>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    
    {
      cout << "First Card, Ace(a) King(k) Queen(q) Jack(j) Ten(t) Nine(9) ect.. and Press Enter" << endl;
    
      char cardone;
      cin >> cardone;
      int cardOnePoints = 0;
    
      switch(cardone) {
        case 'a': cardOnePoints = 16; break;
        case 'k': cardOnePoints = 14; break;
        case 'q': cardOnePoints = 13; break;
        case 'j': cardOnePoints = 12; break;
        case 't': cardOnePoints = 11; break;
        case '9': cardOnePoints = 9; break;
        case '8': cardOnePoints = 8; break;
        case '7': cardOnePoints = 7; break;
        case '6': cardOnePoints = 6; break;
        case '5': cardOnePoints = 5; break;
        case '4': cardOnePoints = 4; break;
        case '3': cardOnePoints = 3; break;
        case '2': cardOnePoints = 2; break;
        default: cardOnePoints = 0; break;
      }
    
      cout << " " << endl;
      cout << "Second Card, Ace(a) King(k) Queen(q) Jack(j) Ten(t) Nine(9) ect.. and Press Enter" << endl
    ;
      cout << " " << endl;
    
      char cardtwo;
      cin >> cardtwo;
      int cardTwoPoints;
    
      switch(cardtwo) {
        case 'a': cardTwoPoints = 16; break;
        case 'k': cardTwoPoints = 14; break;
        case 'q': cardTwoPoints = 13; break;
        case 'j': cardTwoPoints = 12; break;
        case 't': cardTwoPoints = 11; break;
        case '9': cardTwoPoints = 9; break;
        case '8': cardTwoPoints = 8; break;
        case '7': cardTwoPoints = 7; break;
        case '6': cardTwoPoints = 6; break;
        case '5': cardTwoPoints = 5; break;
        case '4': cardTwoPoints = 4; break;
        case '3': cardTwoPoints = 3; break;
        case '2': cardTwoPoints = 2; break;
        default: cardTwoPoints = 0; break;
      }
    
      //only need one variable to store points for the rule that applied
      //since only one rule can apply :)
    
      int rulePoints = 0; // better name?
    
      cout << " " << endl;
      cout << "Are your cards Paired yes(y) no(n)?" << endl;
      cout << " " << endl;
    
      char yesorno;
      cin >> yesorno;
      rulePoints = yesorno == 'y' ? 10 : 0;
    
      if(!rulePoints) { //a previous rule hasn't been applied yet ask another question
          cout << " " << endl;
          cout << "Are your cards Suited yes(y) no(n)?" << endl;
          cout << " " << endl;
    
          cin >> yesorno;
          rulePoints = yesorno == 'y' ? 4 : 0;
      }
    
      if(!rulePoints) { //a previous rule hasn't been applied yet ask another question
          cout << " " << endl;
          cout << "Are your cards connected (ie, next to each other in rank as with J10 or JQ etc.) (y),(
    n)" << endl;
          cout << " " << endl;
    
          cin >> yesorno;
          rulePoints = yesorno == 'y' ? 3 : 0;
      }
    
      //.... rest of rules
    
      cout << " " << endl;
      cout << "Call a bet with 30 points or more, and raise or call a raise with 34 points or more." << e
    ndl;
      cout << " " << endl;
    
      cout << cardOnePoints + cardTwoPoints + rulePoints << endl;
    
      system( "PAUSE" );
      return 0;
    }

  15. #15
    Registered User
    Join Date
    Nov 2005
    Posts
    5
    Ok so heres the lastest model of this program...i have some questions after the code so please read on

    Code:
    #include <iostream>
    #include <cstdlib>
    #include <string>
    #include <cmath>
    
    using namespace std;
    
    int main(int argc, char *argv[])
    
    {
      cout << "First Card, Ace(a) King(k) Queen(q) Jack(j) Ten(t) Nine(9) ect.. and Press Enter" << endl;
    
      char cardone;
      cin >> cardone;
      int cardOnePoints = 0;
    
      switch(cardone) {
        case 'a': cardOnePoints = 16; break;
        case 'k': cardOnePoints = 14; break;
        case 'q': cardOnePoints = 13; break;
        case 'j': cardOnePoints = 12; break;
        case 't': cardOnePoints = 11; break;
        case '9': cardOnePoints = 9; break;
        case '8': cardOnePoints = 8; break;
        case '7': cardOnePoints = 7; break;
        case '6': cardOnePoints = 6; break;
        case '5': cardOnePoints = 5; break;
        case '4': cardOnePoints = 4; break;
        case '3': cardOnePoints = 3; break;
        case '2': cardOnePoints = 2; break;
        default: cardOnePoints = 0; break;
      }
    
      cout << " " << endl;
      cout << "Second Card, Ace(a) King(k) Queen(q) Jack(j) Ten(t) Nine(9) ect.. and Press Enter" << endl
    ;
      cout << " " << endl;
    
      char cardtwo;
      cin >> cardtwo;
      int cardTwoPoints;
    
      switch(cardtwo) {
        case 'a': cardTwoPoints = 16; break;
        case 'k': cardTwoPoints = 14; break;
        case 'q': cardTwoPoints = 13; break;
        case 'j': cardTwoPoints = 12; break;
        case 't': cardTwoPoints = 11; break;
        case '9': cardTwoPoints = 9; break;
        case '8': cardTwoPoints = 8; break;
        case '7': cardTwoPoints = 7; break;
        case '6': cardTwoPoints = 6; break;
        case '5': cardTwoPoints = 5; break;
        case '4': cardTwoPoints = 4; break;
        case '3': cardTwoPoints = 3; break;
        case '2': cardTwoPoints = 2; break;
        default: cardTwoPoints = 0; break;
      }
    
      //only need one variable to store points for the rule that applied
      //since only one rule can apply :)
    
      int rulePoints = 0; 
      int rulePoints2 = 0; 
      int suited = 0;
      int connected = 0;  
      int latePos = 0;
    
      cout << " " << endl;
      cout << "Are you in late position? (y),(n)" << endl;
      cout << " " << endl;
      
      char yesorno;
      cin >> yesorno;
      latePos = yesorno == 'y' ? 4 : 0;
      
      if(!rulePoints) {
      rulePoints = cardone == cardtwo ? 10 : 0;
      }
    
    //ok if rulePoints = 10 i want the program to stop running and output the total right then being that if the two cards are paired
     the answer will automatically be no for the rest of the questions..right now the program works but still askes
     the following questions even though they are no longer needed.
      
      if(!suited) {
          cout << " " << endl;
          cout << "Are your cards Suited yes(y) no(n)?" << endl;
          cout << " " << endl;
    
          cin >> yesorno;
          suited = yesorno == 'y' ? 4 : 0;
      }
      
      if(!connected) {
          cout << " " << endl;
          cout << "Are your cards connected (ie, next to each other in rank as with J10 or JQ etc.) (y),(n)" << endl;
          cout << " " << endl;
    
          cin >> yesorno;
          connected = yesorno == 'y' ? 3 : 0;
      }
    
      if(!connected) { //single gap question
          cout << " " << endl;
          cout << "Are your cards single \"gapped\" (ie, Q10 or J9 etc.) (y),(n)" << endl;
          cout << " " << endl;
          
          cin >> yesorno;
          connected = yesorno == 'y' ? 2 : 0;
          
      }
      
      if(!connected) { //double gap question
          cout << " " << endl;
          cout << "Are your cards double \"gapped\" (ie, AJ or Q9 etc.) (y),(n)" << endl;
          cout << " " << endl;
          
          cin >> yesorno;
          connected = yesorno == 'y' ? 1 : 0;         
          
      }
      
      cout << " " << endl;
      cout << "Call a bet with 30 points or more, and raise or call a raise with 34 points or more." << endl;
      cout << " " << endl;
    
      cout << cardOnePoints + cardTwoPoints + rulePoints + latePos + suited + connected << endl;
    
      system( "PAUSE" );
      return 0;
    }
    Ok so in the middle of the code you can see my thoughts of what i want to do. I'm just not sure how exactly to get it done. any help is as always greatly appreciated...thanks ahead of time

    I'm loving this C++ stuff lol

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please Help A Noob Here (plz Im Begging You)
    By bobbie18 in forum C Programming
    Replies: 97
    Last Post: 03-28-2008, 03:38 AM
  2. Complete C noob...and completely stuck lol
    By JST212 in forum C Programming
    Replies: 6
    Last Post: 03-02-2008, 09:54 AM
  3. plz help here, noob actually .D
    By BjoRn3n in forum C++ Programming
    Replies: 1
    Last Post: 03-07-2005, 02:04 PM
  4. noob: compiling error... plz help!
    By chosii in forum C Programming
    Replies: 2
    Last Post: 05-10-2002, 05:53 AM
  5. Lol!
    By no-one in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 02-11-2002, 11:29 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21