Write a program in c that arranges and prints out

Assignment Help C/C++ Programming
Reference no: EM13784289

When playing poker and other card games (standard 52 cards, excluding the jokers), it is usual to arrange a hand to reflect its values. Write a program in C that arranges and prints out a random hand of ten cards in sorted order by pips values. Assume that an ace is highest in value, a king is next highest, which is followed by a queen, a jack, and so forth. For cards of the same pips values, use their suits to sort them in the order of Clubs, Diamonds, Hearts, and Spades. Notice that no card shows more than once in a hand.

In order for the hands of cards dealt by the program to be truly random, have the following line at the beginning of your program: (You need #include <time.h> though.)

srand(time(NULL));

The following screen shot contains two sample outputs of the program.

You may use ch7/test_drive.c as your reference to use a "comparator" function and qsort() to sort your cards.

Although it is totally up to you how you design your program, it needs to satisfy the following rules:

- It consists of at least 3 source files (.c files) and at least 3 header files (.h files).
- It uses structures (and optionally unions and enums) to model poker cards.
- It is organized in the following way:

o bin_files/ : a subfolder that holds executable file(s)
o obj_files/ : a subfolder that holds object file(s)
o inc_files/ : a subfolder that holds header file(s)
o src_files/ : a subfolder that holds source file(s)

- It comes with a workable makefile.

Reference no: EM13784289

Questions Cloud

Major components of a safety and health plan : State the major components of a safety and health plan, describe each component, and discuss how you would structure each component of the plan on a construction site that you are in control. Use the Safety and Health Program Evaluation Checklist ..
What is the importance of physical or real evidence : What is the importance of physical or real evidence to the investigation? Explain. What are two methods of demonstrative evidence used to clarify the issues surrounding actions or lack of actions at a crime scene for a judge or jury? Explain
Ethical theories utilitarianism : Prepare an essay (2000 words approx) which uses the ethical theories utilitarianism, duty and rights ethics, and virtue ethics to argue the validity of the following statement:
Keys to investing and analyzing the accuracy : Analyze the exit strategy for your business and explain the trigger for the exit strategy.
Write a program in c that arranges and prints out : When playing poker and other card games (standard 52 cards, excluding the jokers), it is usual to arrange a hand to reflect its values. Write a program in C that arranges and prints out a random hand of ten cards in sorted order by pips values.
Analyze it costs by accounting : Why is it important to be able to analyze IT costs by accounting, asset, service, and technology tower views?
Write a paper about world inflation is falling : Write a paper about WORLD INFLATION IS FALLING.
What are contracts and what purpose do they serve : What are contracts and what purpose do they serve? (Include these in the explanation: Power of attorney, Bill of sales, Employment contracts, Residential agreements, Licensing agreements.
History of being a very controversial area : Sexual Research has a long history of being a very controversial area of scientific study. What are some of the problems sex researchers have encountered - funding, ethics, truthful participants? How are current researchers combating these issues?..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Question 1a doubly linked list is like a linked list except

question 1a doubly linked list is like a linked list except that each node has a pointer both to the next node in the

  Execute the next line which is enter your last name

C++ in VS and I'm trying to run the following program. As soon as I put in my name after the 2nd cout statement, the program ends.

  Write a program that asks the user for a positive integer

Write a program that asks the user for a positive integer N and generates the Nth Fibonacci number.

  C write a function which adds the two numbers

1. In C write a function which adds the two numbers. Test this function by calling from the main. In main, the user should be asked to provide the two numbers.

  Write a program that computes the total sales tax

Write a program that computes the total sales tax on a $52 purchase. Assume the state sales tax is 4 percent and the states sales tax is 4 percent and the country sales tax is 2 percent;

  Write a program using a function and a switch statement

Write a program using a function and a switch statement. The user should be prompted to enter a number in main.

  Write function compute square root together with prototype

Write a C++ function called compute together with its prototype that is passed 2 integers, A and B and returns the square root of A2+B2 ,as a double.

  Write a program using a function and a series

Write a program using a function and a series of if...else statements - You may decide to limit the number entered by the user to a particular range. Make sure to prompt the user with this range, so you can deal with correct and incorrect numbers e..

  Reduce the numerator and denominator

Write the function  in C ++ to reduce the numerator and denominator in the Rat class to lowest terms.

  Display the list of all car record

Sales and Profits - show car model, the number of car in stock, car sold, unit cost, selling price and the profit for each car and the total profit for all cars.

  Write a program that find the average time spent programming

Write a program that finds the average time spent programming by a student each day over a 3 day period.

  Write the function - void shuffle

Write the function: void shuffle(int ar[], int size); This function "shuffles" the elements in the array pointed by 'ar' (and whose length is 'size').

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd