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.
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 timeCode:#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; }



LinkBack URL
About LinkBacks



I used to be an adventurer like you... then I took an arrow to the knee.