I m getting lost in here...

Declaring a C++ object is the same. Use the object name as the data type. cardDeckType deck; //cardDeckType is the data type, deck is the variable.



I don't understand that the cardDeckType is exist as a data type?

here is my code..

#include <iostream>
#include <iomanip>
//#include "cardDeckType.h"
using namespace std;
int main(int argc, char*argv[])

{
cardDeckType deck;
int round = 1;
enum GameType {NORMAL, tie0 , tie3, tie33 ,tie_other, P1_win, P2_win};

int newtotalp1 = 0;
int newtotalp2 = 0;

int totalp1 = 0;
int totalp2 = 0;

int yourSelection=1;
int currentCard=-1;

int playerOnec1= 0;
int playerOnec2= 0;
int playerOnec3= 0;

int playerTwoc1= 0;
int playerTwoc2= 0;
int playerTwoc3= 0;

bool duplicate = true;


cout << setfill ('-') << setw (42);
cout << "-" << endl;
cout << "Welcome to the Lunch Time Dessert 333 Game" << endl;
cout << setfill ('-') << setw (42);
cout << "-" << endl;

if (argc>1)
{
cout << "Test Bench Menu" << endl;
cout << "1- Normal" <<endl;
cout << "2- duplicate table cards" << endl;
cout << "3 - Tie score 0" << endl;
cout << "4 - Tie score 3" << endl;
cout << "5 - Tie score 33" << endl;
cout << "6 - Tie score other" << endl;
cout << "7 - Player 1 win" << endl;
cout << "8 - Player 2 win" << endl;
cout << "Enter your selection" << endl;
cin>> yourSelection;

switch (yourSelection)
{
case 1:
{
deck.setDeck(normal);
deck.shuffle();
break;
}
case 2:
{
deck.setDeck(duplicate);
break;
}
case 3:
{
deck.setDeck(tie0);
break;
}
case 4:
{
deck.setDeck(tie3);
break;
}
case 5:
{
deck.setDeck(tie33);
break;
}
case 6:
{
deck.setDeck(tie_other);
break;
}
case 7:
{
deck.setDeck(P1_win);
break;
}
case 8:
{
deck.setDeck(P2_win);
break;
}


}
}
else if (argc==1)
{
deck.setDeck(NORMAL);
deck.shuffle();
}

playerOnec1 = deck.drawCard();
playerTwoc1 = deck.drawCard();

playerOnec2 = deck.drawCard();
playerTwoc2 = deck.drawCard();

playerOnec3 = deck.drawCard();
playerTwoc3 = deck.drawCard();

totalp1 = playerOnec1 + playerOnec2 + playerOnec3;
totalp2 = playerTwoc1 + playerTwoc2 + playerTwoc3;

cout << " Player 1: " << playerOnec1 << "" << playerOnec2 << "" <<playerOnec3;
cout << " Total: " << totalp1 << endl;
cout << " Player 2: " << playerTwoc1 << "" << playerTwoc2 << "" << playerTwoc3;
cout << " Total: " << totalp2 << endl;



it is not finish yet.. Currently I complied this end but it show the error.

the error is "deck" is not declared in the scoop and cardDeckType as well.

any idea please . Thanks
PLEASE USE CODE TAGS.

You appear to have commented out the include file that would have brought the definition of cardDeckType into scope.
Excuse Me! Possibly could you show me with an example? Because I m rookie of C++ and just practice to get experience.
Thanks
Example of what? Just uncomment the line that would include cardDeckType.h
Topic archived. No new replies allowed.