I have a Blackjack Assignment I need some help on. The Full requirements, what the .exe should look like, and what I have done so far is in this picasa link:
Sorry I couldn't get the insert link to work right.
What I have done: I have shuffled the cards and dealed 2 cards to each player besides the dealer.
Problem: I need an array to hold the cards and an array to calculate the total
It doesn't seem that tough but I was instructed to only use the switch(num) statement and shuffle code once in the program.
Refer back to the link I included with this post, Colored in Green Above.
I am really having a tough time starting this project, I had two other projects this year I aced but this is something else.
#include <iostream>
#include <iomanip>
#include <ctime>
#include <windows.h>
#include <stdio.h>
using namespace std;
void Header();
void Shuffle();
void Dealer();
void Deal();
void Another_Card();
void Fin_Dealer();
void WLT();
void gotoxy(int h, int w)
{
HANDLE hConsole = GetStdHandle ( STD_OUTPUT_HANDLE );
if ( INVALID_HANDLE_VALUE != hConsole )
{
COORD pos = {h, w};
SetConsoleCursorPosition ( hConsole, pos );
}
return;
}
int main()
{ char restart;
Header();
Dealer();
Deal();
WLT();
gotoxy(0,19);
return 0;
}
void Header()
{
cout <<"\t\t\tWelcome to BlackJack!\n\n";
gotoxy(3,3);
cout <<"Dealer Player1 Player2 Player3 Player4 Player5 Player6 Player7 "<<endl;
return;
}
void Shuffle(int num, char suit)
{
return;
}
void Dealer()
{
return;
}
void Deal()
{
int cards[52], dup[52];
int i = 0, card, num, rows;
char suit;
srand(time(NULL));
for(i =0; i <52; i++)
dup[i] = 0;
for (int i = 1; i <8; i++)
{
for(rows = 4; rows <6; rows++)
{
gotoxy(i*8,rows);
card = rand() % 52;
while(dup[card])
card = rand() % 52;
dup[card] = 1;
suit = char(card/13 + 3); //display suit
num = card %13;
switch(num)
{
case 0: cout<<setw(6)<<right<<" A"<<suit;
break;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9: cout<<setw(6)<<right<<" "<<num + 1<<suit;
break;
case 10: cout<<setw(6)<<right<<" J"<<suit;
break;
case 11:cout<<setw(6)<<right<<" Q"<<suit;
break;
case 12:cout<<setw(6)<<right<<" K"<<suit;
break;
default:cout<<setw(6)<<right<<"Error";
break;
}
}
}
return;
}
void Another_Card()
{
return;
}
void Fin_Dealer()
{
return;
}
void WLT()
{
return;
}