Number of tries to correctly guess a word

Assignment Help Business Economics
Reference no: EM131524326

Word guessing game: 

Overview: I must create a game in which the user has a set number of tries to correctly guess a word. 

Win condition: If the user correctly guesses and reveals all of the letters, the guessing will end and print "You win" and reveal the word.

Loss condition: The user will only see a "game over" print and be revealed the word.

Required functionality:

  • Main()Should contain the following variables:
  • two arrays of chars. One array named answer to hold a word for the user to guess. the second an exact same sized char array initialized all to the "*" character
  • a constant int for size shared between the two exact same sized arrays called size
  • an int named guesses initialized to double the size of your size variable.
  • an int named revealed initialized to zero.
  • a char named guess initialized to '0'.
  • This should contain the base functionality of the game. A loop should control the game and check if guesses are greater than zero and revealed is less than size.
  • Ask the user for a guess and call check guess.
  • if check guess returns true, let the user know they revealed a letter and call revealLetter().
  • decrement guesses by one as now a turn has been consumed. This must be outside of any conditional logic above^
  • perform a check to see if revealed == size to see if the user revealed all the letters.
  • display() - This function is called anytime the contents of an array needs to be printed on the screen. This should be passed an array, and the size integer.
  • checkGuess() - This is a boolean function that will return true if a match is found in the answer array passed into it. You will need to pass the user's guess to compare, the correct answer array, and the size integer of the array.
  • revealLetter() - This void function should be passed the matching guess char, the answer array, the word array, the size of the arrays (one variable), and REFERENCE to "revealed" so it can be iterated. This function should look through the answer array and find the matching element between the user's guess and the answer array. Copy the answer element data into the word array at that exact position to simulate revealing the letter. Lastly, increment revealed.

Reference no: EM131524326

Questions Cloud

Assist in organizational decision making : In addition, explain why mitigating risk and making better decisions are essential to operational efficiency.
How has technology aided inventory management : What are some of the ways in which a company can reduce the need for inventories? How has technology aided inventory management
What medications did you purchase from an online pharmacy : The data that organizations gather about their user can vary between strictly commercial information. What medications did you purchase from an online pharmacy.
Non-receptive you would be to the salesman sales pitch : Explain how receptive or non-receptive you would be to the salesman's "sales pitch" and why,
Number of tries to correctly guess a word : If the user correctly guesses and reveals all of the letters, the guessing will end and print "You win" and reveal the word.
What high-risk behaviors or irrational thoughts : What high-risk behaviors or irrational thoughts could lead to relapse - What coping skills may help the client remain sober?
Calculate the evpi for the decision : Explain why in decision analysis we are concerned with the expected value of information.
Create a diagram of the organizational structure : Create a diagram of the organizational structure showing the hierarchy and chain of command. Conduct a capacity analysis of the location(s) and logistics
What are the potential penalties that john could face : John uses a small camcorder and secretly records a movie shown at his local theater. What are the potential penalties that John could face?

Reviews

Write a Review

Business Economics Questions & Answers

  Economics assignment

This document contains various important questions and their appropriate answers in the subject field of Economics.

  Demand and supply curves

Economics is the study of the principles governing the allocation of scarce means among competing ends when the objective of the allocation is to maximize the attainment of the ends.

  Long-run perfectly competitive equilibrium for the firm

Evaluate Government intervene and correct this situation?(a) Explain the concept of a concentration ratio. A rise in the price of magarine Explain the impact of external costs and external benefits on resource allocation long-run perfectly c..

  Supply and demand diagrams

Explain each of the following using supply and demand diagrams,  With the use of a graph, explain how these two programs affect cigarette consumption and the price of cigarettes.

  Case study: fisher-price toys

The case study of the Fisher-Price Toys, Inc., a popular case in basic economics and management from the prestigious Harvard Business School.

  Draw the production possibility curve

Draw the production possibility curve and a. Define consumer surplus and producer surplus.

  Tax revenue

The Australian government administers two programs that affect the market for cigarettes

  Maximize total welfare

How many tickets to sell to maximize total welfare.

  Difference between the cv and the ev

The change in consumer surplus (?CS) is not "theoretically" justifiable like the CV and EV but it continues to be the most widely used measure of consumer welfare change. Explain how this can be reconciled

  Depict von neumann-morgenstern utility index u in a diagram

Depict the von Neumann-Morgenstern utility index u in a diagram

  What is the market solution

What is the market solution (market price and quantity) and What is the total surplus of the society under the market solution

  Calculate gross national product and net national product

Calculate gross national product and net national product

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