create a framework for queues

Completed Posted Mar 4, 2004 Paid on delivery
Completed Paid on delivery

define the following structures:

struct SQueueNode {

char *cCard; // dynamic string

TQueueNode pNext;

} TQueueNode;

struct SQueue {

TQueueNode pFront; // pointer to the first element

TQueueNode pRear; // pointer to the last element

int iSize; // number of elements

} TQueue;

(b) The framework:

You are to create a framework for queues consisting of the following functions:

- TQueue *createQueue();

Initializes queue and returns a pointer to it.

- int enqueue(TQueue *q, char *c);

Enqueues 'c'. Returns 0 if the operation cannot be completed -- 1 otherwise.

- int dequeue(TQueue *q, char *c);

Dequeues to 'c'. Returns 0 if the operation cannot be completed -- 1 otherwise.

- int frontQueue(TQueue *q, char *c);

Retrieves the front of the queue to 'c'. Returns 0 if the operation cannot be completed -- 1 otherwise.

- int rearQueue(TQueue *q, char *c);

Retrieves a data from the rear of the queue to 'c'. Returns 0 if the operation cannot be completed -- 1 otherwise.

- void destroyQueue(TQueue *q);

Frees the memory allocated for the queue. Remeber to take care of freeing dynamic string before freeing the memory for the whole queue element.

(c) Problems to solve:

Using the framework defined above you are to implement the following functions:

- TQueue *readDeck();

Reads in a deck of cards (code for each card consists of two characters: card name and color, e.g. 10S for 10 Spades) and place the deck in a queue. You will be provided with the file containing a deck of cards -- you do not need to handle I/O errors, except checking if the file exists.

- void shuffleDeck(TQueue *q, int iShuffleCount)

Shuffles the deck. First splits the original deck into two decks (queues). Then shuffles taking cards from either of the new decks (use a random number generator to decide which deck to take card from at every iteration of the algorithm). Repeates shuffling 'iShuffleCount' times. The deck should be printed after every shuffle.

- void dealDeck(int iPlayersCount);

Deal the cards for 'iPlayersCount' people (<10). Here make use of an array of queues. Create a 1-dimentional array with 9 cells.

## Deliverables

1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.

2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.

3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).

## Platform

"Unix", Visual Studio 6.0

C Programming Engineering Linux MySQL PHP Software Architecture Software Testing UNIX

Project ID: #3122091

About the project

20 proposals Remote project Active Mar 5, 2004

Awarded to:

DanD

See private message.

$14 USD in 7 days
(212 Reviews)
5.8

20 freelancers are bidding on average $35 for this job

mihaiscortaru

See private message.

$40 USD in 7 days
(160 Reviews)
6.0
idleswell

See private message.

$17 USD in 7 days
(175 Reviews)
5.9
emilianbold

See private message.

$5.95 USD in 7 days
(78 Reviews)
5.8
utopiaprogr

See private message.

$38.25 USD in 7 days
(62 Reviews)
5.4
vangelisdimou

See private message.

$7.65 USD in 7 days
(61 Reviews)
5.1
Gr8Coders

See private message.

$19.55 USD in 7 days
(52 Reviews)
4.9
lmxvw

See private message.

$21.25 USD in 7 days
(126 Reviews)
4.7
shahizanvw

See private message.

$85 USD in 7 days
(46 Reviews)
4.6
msmughal

See private message.

$17 USD in 7 days
(46 Reviews)
3.7
tyr1981

See private message.

$4.25 USD in 7 days
(21 Reviews)
3.5
vladimirlagutin

See private message.

$11.9 USD in 7 days
(20 Reviews)
3.3
dizm

See private message.

$8.5 USD in 7 days
(6 Reviews)
3.2
mahmoudseireg

See private message.

$9.35 USD in 7 days
(6 Reviews)
2.9
rprokop

See private message.

$17 USD in 7 days
(4 Reviews)
0.6
nestervw

See private message.

$42.5 USD in 7 days
(0 Reviews)
0.0
romit123

See private message.

$212.5 USD in 7 days
(0 Reviews)
0.0
dalric

See private message.

$12.75 USD in 7 days
(0 Reviews)
0.0
subsvw

See private message.

$85 USD in 7 days
(0 Reviews)
0.0
k17crew

See private message.

$25.5 USD in 7 days
(0 Reviews)
0.0