C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 17, Problem 17.24E
Program Plan Intro

Program plan:

  • Creates a Poker hand of 5 cards after dealing shuffled cards. Poker hands are verified for availability of similar face and suit.
  • Poker Hand is validated for followings
    • Check if pair of face is found in Poker Hand
    • Check if two pairs are found in Poker hand.
    • Check if three same suits are found in Poker hand.
    • Check if four same suits are found in Poker hand.
    • Check if all suits are same to call it FLUSH.
    • Check if all faces are consecutive to call it STRAIGHT.

Program Description:

This Program is modified version of program from exercise 17.23.

Blurred answer
Students have asked these similar questions
(GREATEST COMMON DIVISOR) The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write and test a recursive function gcd that returns the greatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0, then gcd (x, y) is x; otherwise, gcd (x, y) is gcd (y, x % y), where % is the remainder operator.
(Card Shuffling and Dealing) Modify the program you developed in Exercise 17.23 so thatit deals a five-card poker hand. Then write functions to accomplish each of the following:a) Determine whether the hand contains a pair.b) Determine whether the hand contains two pairs.c) Determine whether the hand contains three of a kind (e.g., three jacks).d) Determine whether the hand contains four of a kind (e.g., four aces).e) Determine whether the hand contains a flush (i.e., all five cards of the same suit).f) Determine whether the hand contains a straight (i.e., five cards of consecutive facevalues)
(String Matching): Write a program to use Horspool’s Algorithm to find the pattern in the string.   You can define two variables called Text and Pattern. Please display shift table for that pattern and display the shift value for each step. If not match, display a message “Unsuccessful Search”. If match, display the index. For example, If Text =“BARD LOVED BANANAS” and Pattern=”BAOBAB”. The result will be: Shift Table: A=1, B=2, O=3, other=6 Shift 6, shift 2, shift 6, pattern not found   If Text=”BARD LOVED BABAOBABANAS” and Pattern=”BAOBAB”. The result will be: Shift Table: A=1, B=2, O=3, other=6 Shift 6, shift 2, shift 2, shift 3, pattern found at position 13 Please let me know the solution which gives exact mentioned outputs in question
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning