hi,
here i would like to display each suite in order from smallest card to largest card suite by suite.
i thought i did everything right, but i dont receive any output on the screen. can anyone give me a hand please?
Code:
#include<iostream>
#include<conio.h>
using namespace std;
#include<iomanip>
#include<cstdlib>
#include<ctime>
// function deal prototype
void deal( const int [][ 13 ], const char *[], const char [] );
int main()
{
// initialize suit array
const char suit[ 4 ] = // you only need const char
{ 3, 4, 5, 6 };
// initialize face array
const char *face[ 13 ] =
{ "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
// initialize deck array
int deck[ 4 ][ 13 ] = { 0 };
deal( deck, face, suit );
getch();
return 0; // indicates successful termination
} // end main
// deal cards in deck
void deal( const int wDeck[][ 13 ], const char *wFace[ 4 ],
const char wSuit[ 4 ] )
{
// for each of the 52 cards
for ( int card = 1; card <= 52; card++ )
// loop through rows of Deck
for ( int row = 0; row <= 3; row++ )
// loop through columns of Deck for current row
for ( int column = 0; column <= 12; column++ )
// if slot contains current card, display card
if ( wDeck[ row ][ column ] == card ) {
cout << setw( 5 ) << right << wFace[ column ]
<< setw( 8 ) << left
<< wSuit[ row ]
<< ( card % 4 == 0 ? '\n' : '\t' );
} // end if
} // end function deal