Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C++ Project - Card Game

Status
Not open for further replies.

Hobbster

MIS
Mar 30, 2001
8
US
Hello,
I am in need of some help. The following is an assignment that I need to complete for a C++ course and I am stuck. I have been working in Visual C++, and I continue to get linking errors when I compile.

I just need some direction. If somebody could help me figure this out, I would appreciate it.

The following is what I've completed so far:
#include <iostream.h>
#include <stdlib.h>
#include <time.h>

// this program draws ten cards but the card may
// be duplicated and the code is not object oriented
void display( int aSuit, int aFace);
int main()
{
int cardNo, suitCode, faceCode;
int i;
srand(time(NULL));
for (i=0; i < 10; i++)
{
// a deck of card has 52 card, we pick a random card
cardNo = rand( )%52;
// figure out suit and face
suitCode = cardNo %4;
faceCode = cardNo %13;
// display card to the monitor
display( suitCode, faceCode);
}
return 1;

}
---------

The following is the description of the project:


__________
Objective
· To demonstrate that you can create classes and object in C++


Description
Part 1:
· Create a class called cardClass. Each object of card class will be one card like Jack of Spade, Ten of Diamond ...
· Your card class should have member functions: display value of card etc...
· It also should have a constructor
· You should create a test program to test your class correctly.
Part 2:
· Now write a program that would generate ten random numbers. Each of number should be between value 0 to 51. No two numbers should have the same value.
· Use these number and create 10 cards. Divide these ten cards into 2 hands of poker. Remember each card will be one variable of your class cardClass
· Display each hand on the monitor. For example,
Player 1 has:
Queen of Club
Three of Heart
Five of Club
Ace of Heart
Three of Diamond
Player 2 has:
King of Diamond
Ace of Club
Six of Heart
King of Spade
Two of Club
· Your program should play again and again until the user does not want to play again
· Optional challenge 1: Display the cards in sorted order, for each hand.
 
Can you say, what the linker error is? John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top