1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
#include <iostream>
using namespace std;
int main()
{
char a, total_cards;
int total, c2, c3, c4, c5, c6, c7, c8, c9;
const int t=10, j=10, q=10, k=10;
bool cards;
do
{
cout<<"How many cards do you have in your hand?\n";
cin>>total_cards;
switch (total_cards)
{
case '2':
cout<<"You have 2 cards, what are they?\n";
cout<<"what is the first card?\n";
cin>>c2;
cout<<"what is the second card?\n";
cin>>c3;
if (c2=a)
c2==1;
total=c2+c3;
cout<<endl<<"The value of your hand is: "<<total;
break;
case '3':
cout<<"You have 3 cards, what are they?\n";
cout<<"what is the first card?\n";
cin>>c2;
cout<<"what is the second card?\n";
cin>>c3;
cout<<"what is the third card?\n";
cin>>c4;
total=c2+c3+c4;
cout<<endl<<"The value of your hand is: "<<total;
break;
case '4':
cout<<"You have 4 cards, what are they?\n";
cout<<"what is the first card?\n";
cin>>c2;
cout<<"what is the second card?\n";
cin>>c3;
cout<<"what is the third card?\n";
cin>>c4;
cout<<"what is the forth card?\n";
cin>>c5;
total=c2+c3+c4+c5;
cout<<endl<<"The value of your hand is: "<<total;
break;
case '5':
cout<<"You have 5 cards, what are they?\n";
cout<<"what is the first card?\n";
cin>>c2;
cout<<"what is the second card?\n";
cin>>c3;
cout<<"what is the third card?\n";
cin>>c4;
cout<<"what is the forth card?\n";
cin>>c5;
cout<<"what is the fifth card?\n";
cin>>c5;
total=c2+c3+c4+c5+c6;
cout<<endl<<"The value of your hand is: "<<total;
break;
default:
cout<<"You must have between 2-5 cards in your hand\n";
}
}while (cards);
cin>>c3;
return 0;
}
|