Hey guys, im new to the forums and really need help with this program. It's worth 35 points for my programming class and I'm freaking out. I keep getting error C2784. Here's the code and I appreciate all your help:
#include <iostream>
#include <string>
#include <ctime>
using namespace std ;
const int NUMBEROFCARDS = 52;
int HeartsCount = 0;
int ClubsCount = 0;
int SpadesCount = 0;
int DiamondsCount = 0;
int CardDrawCount = 0;
int SuitCount = 0;
// Shuffle the elements in an array
void Shuffle(int List[], int Size)
{
srand(time(0));
for (int I = 0; I < Size; I++)
{
// Generate an index randomly
int Index = rand() % NUMBEROFCARDS;
int Temp = List[I];
List[I] = List[Index];
List[Index] = Temp;
}
}
int main()
{
int Deck[NUMBEROFCARDS];
const string Suits[] = {"Clubs", "Diamonds", "Hearts", "Spades"};
const string Ranks[] = {"Ace", "2", "3", "4", "5", "6", "7", "8",
"9", "10", "Jack", "Queen", "King"};
// Initialize cards
for (int I = 0; I < NUMBEROFCARDS; I++)
Deck[I] = I;
// Shuffle the cards
Shuffle(Deck, NUMBEROFCARDS);
//Reber's loop
while (SuitCount < 4)
{
// Draw a card
// Which suit is it?
if(Ranks[Deck[CardDrawCount] % 13] == 0 )
{
ClubsCount++; // Bump Suit counter
if(ClubsCount < 2) { // 1st of suit? Print to screen
cout << Ranks[Deck[CardDrawCount] % 13] << " of " << Suits[Deck[CardDrawCount] / 13] << endl;
SuitCount++;
}
CardDrawCount++; // Up overall counter
}
if(Ranks[Deck[CardDrawCount] % 13] == 1 )
{
DiamondsCount++; // Bump Suit counter
if(DiamondsCount < 2) { // 1st of suit? Print to screen
cout << Ranks[Deck[CardDrawCount] % 13] << " of " << Suits[Deck[CardDrawCount] / 13] << endl;
SuitCount++; // 1st of suit? Bump counter
}
CardDrawCount++; // Up overall counter
}
if(Ranks[Deck[CardDrawCount] % 13] == 2 )
{
HeartsCount++; // Bump Suit counter
if(HeartsCount < 2) { // 1st of suit? Print to screen
cout << Ranks[Deck[CardDrawCount] % 13] << " of " << Suits[Deck[CardDrawCount] / 13] << endl;
SuitCount++;
}
CardDrawCount++; // Up overall counter
}
if(Ranks[Deck[CardDrawCount] % 13] == 3 )
{
SpadesCount++; // Bump Suit counter
if(SpadesCount < 2) { // 1st of suit? Print to screen
cout << Ranks[Deck[CardDrawCount] % 13] << " of " << Suits[Deck[CardDrawCount] / 13] << endl;
SuitCount++;
}
CardDrawCount++; // Up overall counter
}
}
return 0;
}