2

Ive been working on this poker program for a while now and ive tried several different ways to make a poker game...i have to make it using very basic c++ ...ill try to post what i already have done

Attachments
//POKER
#include <iostream>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>
using namespace std;
int main()
{
int choice;
char name[20];
char card[52][2];
card[0][0]='A';
card[0][1]=3;
cout<<" \n PPPPPPPPPPP   OOOOOOOOOOO   KK     KK   EEEEEEEEEE   RRRRRRRRR ";
cout<<" \n PP       PP   OO       OO   KK    KK    EE           RR     RR ";
cout<<" \n PP       PP   OO       OO   KK   KK     EE           RR     RR ";
cout<<" \n PP       PP   OO       OO   KK  KK      EE           RR     RR ";
cout<<" \n PPPPPPPPPPP   OO       OO   KKKK        EEEEEEE      RR     RR ";
cout<<" \n PP            OO       OO   KK KK       EE           RRRRRRRRR ";
cout<<" \n PP            OO       OO   KK  KK      EE           RR  RR    ";  
cout<<" \n PP            OO       OO   KK   KK     EE           RR   RR   ";
cout<<" \n PP            OO       OO   KK    KK    EE           RR    RR  ";
cout<<" \n PP            OOOOOOOOOOO   KK     KK   EEEEEEEEEE   RR     RR ";
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"Welcome to the poker table!";
cout<<endl;
cout<<"To see the instructions press 1, to play the game press 2 and to quit press 0.";
cout<<endl;
cin>>choice;
if (choice==1) goto instruct;
if (choice==2) goto game;
if (choice==3) goto end;

instruct:
	cout<<"INSTRUCTIONS";
	cout<<endl;
	cout<<"Poker is a game of skill, intelligence, and good ol' guts.";
	cout<<endl;
	cout<<"Do you have what it takes to win some ca$h?";
	cout<<endl;
	cout<<"The dealer will give you 5 cards. You can look at them.";
	cout<<endl;
	cout<<"The object is to obtain combinations of cards that are better than your opponents.";
	cout<<endl;
	cout<<"Here is a chart showing the combinations of cards from best to worst.";
	cout<<endl;
	cout<<endl;
	cout<<endl;
	cout<<endl;
	cout<<"Rank       Hand Name          Description                    Example";
	cout<<endl;
	cout<<"_______________________________________________________________________________";
	cout<<endl;
	cout<<" 1         Royal Flush        A,K,Q,J,10 of same suit         10S,JS,QS,KS,AS";
	cout<<endl;
	cout<<" 2         Straight Flush     5 cards same suit in order      4D,5D,6D,7D,8D";
	cout<<endl;
	cout<<" 3         4 of a kind        4 cards of the same rank        7S,7D,7H,7C";
	cout<<endl;
	cout<<" 4         Full house         3 of a kind plus a pair         3D,3S,3C,KS,KH";
	cout<<endl;
	cout<<" 5         Flush              5 cards of the same suit        3H,7H,10H,QH,AH";
	cout<<endl;
	cout<<" 6         Straight           5 cards in sequence             5C,6D,7C,8H,9S";
	cout<<endl;
	cout<<" 7         3 of a kind        3 cards of the same rank        JH,JS,JD";
	cout<<endl;
	cout<<" 8         2 pair             2 pairs of different rank       5H,5S,9C,9S";
	cout<<endl;
	cout<<" 9         1 pair             2 cards of the same rank        AS,AD";
	cout<<endl;
	cout<<" 10        high card          highest card in your hand       10H";
	cout<<endl;
	cout<<endl;
	cout<<endl;
	cout<<endl;
	cout<<"If you would like to play the game now press 2.";
	cout<<"If you would like to quit the game press 0.";
	cin>>choice;
	if (choice==2) goto game;
	if (choice==0) goto end;
game:
	cout<<"GAME";
	cout<<endl;
	cout<<"What is your name, sir?";
	cin.getline(name,20,'\n');
	cout<<endl;
	cout<<"OK, "<<name<<", we will be playing 5 card draw.";
	cout<<endl;
	cout<<"This means you can exchange all five of your cards if you wish.";
	cout<<endl;




	cout<<"If you would like to quit press 0.";
	cout<<"If you would like to play another hand press 2.";
	cin>>choice;
	if (choice==0) goto end;
	if (choice==2) goto game;
end:
return 0;
}
3
Contributors
2
Replies
3
Views
13 Years
Discussion Span
Last Post by Justin7
1

i dont know very much about c as of yet, but from what happend to me and looking at your source you forgot to add a line for what to do if your choice is somthing other than 0 1, it needs a value for Null (no entry) and all characters numbers from a-z 2-9 (because 1 and 0 are being used they are excluded) because when i just pressed enter the program got stuck in a loop and started spitting a line of text which i couldnt read, as fast as the computer could. also when it asked for a name, it never gave me a chance to enter my name, the program merely proceeded to the next line.

-2

I'm sorry but when you want to program something in c++ you have to have backend stuff aswell. You have nothing in the "game" to manage a deck, deal a hand, rate the hand or anything. So far you have done the easy part which is to say what it should output.

Votes + Comments
bumped a seriously old thread.
Yeah, and you did the easy part of showing up 5 YEARS LATE
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.