Problem #1:

Write a complete program.

In your program, do the following:

  • seed the random number generator with the current time
  • ask the user how many cards to display
  • for each card that you need to display
    • make sure that each card is displayed on a separate line
    • display the card value
    • card value = a random number from 1 to 13
    • only display the number itself if the value is 2 to 10
    • display "Ace" for 1, "Jack" for 11, "Queen" for 12, and "King" for 13
    • display " of "
    • display a suit
    • suit value = a random number from 0 to 3
    • display "Spades" for 0, "Hearts" for 1, "Clubs" for 2, and "Diamonds" for 3
    • example: Ace of Spades
    • example: 4 of Clubs
    • example: Queen of Hearts
    • example: 10 of Clubs

Problem #2

Write a complete program.

In your program, do the following:

  • seed the random number generator with the current time
  • ask the user for a minimum value (integer)
  • ask the user for a maximum value (integer)
    • validate that the maximum value is bigger than the minimum value, and keep asking for a new maximum until you get a validate value
  • tell the user "I am thinking of a number from [min] to [max]." using your actual min and max values (example: "I am thinking of a number from -5 to 20.")
  • generate a random number in the range from minimum to maximum, including both values
    • the make rand() generate the maximum you will need to write down some examples on scratch paper and think about what you need to do to make it happen
  • in a loop
    • ask the user to guess the value that the computer has picked
    • if the user's number is right, tell them it is correct and exit the loop
    • if the user's number is too high, tell them it is too high and repeat the loop
    • if the user's number is too low, tell them it is too low and repeat the loop
  • display "Thank you for playing." before you exit the program
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.