All pastes #257265 Raw Edit

Something

public cpp v1 · immutable
#257265 ·published 2006-11-25 03:18 UTC
rendered paste body
#include <iostream>#include <cctype>using namespace std; int main (){    char carde;    int number_of_cards, i, total, tmp;        cout << "This is a blackjack program.\n";    cout << "Type the number of cards you have in your hand (Should be between 2-5 cards).\n";    cin >> number_of_cards;    cout << "Enter 2-9 if you have that card. If you have a 10, type t.\n";    cout << "If you have a jack, type j. Queen, type q. King, type K.\n";    cout << "If you have an ace, type a if you'd like for it to be a one, A for eleven.\n";        for(i=0;i<number_of_cards;i++)    {         cin >> card;		card = toupper(card);		switch(card){			case 'A':				if(total > 10){ //change it to a 1					tmp = 1;				}else{					tmp = 11;				}			break;			case 'J':				tmp = 10;			break;			case 'Q':				tmp = 10;			break;			case 'K':				tmp = 10;			break;			case 'J':				tmp = 10;			break;			case 'T':				tmp = 10;			break;			default :				if(isdigit(card) == true && card != 0 && card != 1){					tmp = card;				}else{					//User intered something stupid help correct this					i--;					cout << "You entered an invalid card please re-enter this card";				}			break;		}        total = total + card;    }        cout << "Your hand score is " << total << " points.\n";              if (total <= 21){     cout << "You don't exactly have 21, but you have a chance of winning this hand.\n";    }    else if (total == 21 ){        cout << "You win!\n";    }    else if (total >= 21){        cout << "Sorry, but since you passed 21, you lose.\n";    }                    system("Pause.");    return 0;}