完了

create a framework for queues

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 プログラミング, エンジニアリング, Linux, MySQL, PHP, ソフトウェアアーキテクチャ, ソフトウェアテスト, UNIX

さらに表示: visual studio random number, use of data structures, use of algorithm in programming, struct c programming, string problems, string algorithm, solve dynamic programming problems, software for dynamic programming, queues in data structures, queues data structures, queue in data structures, queue data structures, queue algorithm in c, programming structures, programming define, problems to solve with programming, problems in data structures, pointer programming, people for hire, party characters for hire

採用者について:
( 4件のレビュー ) United States

プロジェクトID: #3122091

アワード:

DanD

See private message.

$14 USD 7日以内
(212レビュー)
5.8

20人のフリーランサーが、このジョブに平均$35で入札しています

mihaiscortaru

See private message.

$40 USD 7日以内
(160件のレビュー)
6.0
idleswell

See private message.

$17 USD 7日以内
(175件のレビュー)
5.9
emilianbold

See private message.

$5.95 USD 7日以内
(78件のレビュー)
5.8
utopiaprogr

See private message.

$38.25 USD 7日以内
(62件のレビュー)
5.4
vangelisdimou

See private message.

$7.65 USD 7日以内
(61件のレビュー)
5.1
Gr8Coders

See private message.

$19.55 USD 7日以内
(52件のレビュー)
4.9
lmxvw

See private message.

$21.25 USD 7日以内
(126件のレビュー)
4.7
shahizanvw

See private message.

$85 USD 7日以内
(46件のレビュー)
4.6
msmughal

See private message.

$17 USD 7日以内
(46件のレビュー)
3.7
tyr1981

See private message.

$4.25 USD 7日以内
(21件のレビュー)
3.5
vladimirlagutin

See private message.

$11.9 USD 7日以内
(20件のレビュー)
3.3
dizm

See private message.

$8.5 USD 7日以内
(6件のレビュー)
3.2
mahmoudseireg

See private message.

$9.35 USD 7日以内
(6件のレビュー)
2.9
rprokop

See private message.

$17 USD 7日以内
(4件のレビュー)
0.6
nestervw

See private message.

$42.5 USD 7日以内
(0件のレビュー)
0.0
romit123

See private message.

$212.5 USD 7日以内
(0件のレビュー)
0.0
dalric

See private message.

$12.75 USD 7日以内
(0件のレビュー)
0.0
subsvw

See private message.

$85 USD 7日以内
(0件のレビュー)
0.0
k17crew

See private message.

$25.5 USD 7日以内
(0件のレビュー)
0.0