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

  Prepare the outline of the final project

What is the probability that a test comes back positive-indicating oil - what is the probability that there is oil in teh ground, if the test comes back positive - Global Energy Outlook

  Path through which contractionary monetary policy works

?Which of the following is the path through which contractionary monetary policy works?  ?Which of the following types of unemployment is considered to be the most controllable through demand-side macroeconomic policy?

  Hard disk to hold data and program

A method of using the hard disk to hold data and program instructions and tricking the computer into thinking that it is random access memory

  Aw materials-labor expense-utilities and rent

During a year of operation, a firm collects $175,000 in revenue and spends $80,000 on raw materials, labor expense, utilities, and rent. The owners of the firm have provided $500,000 of their own money to the firm instead of investing the money and e..

  Firm uses labor and capital to produce an output

A firm uses labor and capital (L, K), to produce an output. The hourly cost of labor is $10 and the hourly cost of capital is $50. Which combinations of labor and capital hours of use represent points on the firm's $100,000 Isocost line? Please show ..

  Discuss the concept of the optimal amount of inequality

Discuss the concept of the “optimal amount of inequality.” What are some of the practical problems in determining how much inequality really is optimal?

  Advantages and disadvantages of using divisional profit

Discuss the advantages and disadvantages of using divisional profit as the basis of incentive compensation for division managers compared to using company profit as the basis.

  Grows vegetables in his back yard

Joe and Jim purchase vegetables at a grocery store, but Jim also grows vegetables in his back yard. Regarding these two practices, which of the following statements is correct?

  Utility of no insurance for the safe diver

Suppose the Ajax Insurance Company provides insurance for skydivers whose wealth before diving is $400. An accident will leave divers with a wealth of $100. The company divides the divers into two classes: safe (probability of an accident = 0.2) a..

  What is the natural rate hypothesis

What is the Natural Rate hypothesis? How does it prove the vertical shape of the Phillips curve? Explain the view of monetarists on policy making with the help of Phillips curve in 1960s and 1970s. Be thorough.

  Units of migraine pain improvement

M=2A+3.5R where M stands for units of migraine pain improvement, A stands for units of acupuncture treatment and R stands for migraine prescription pills. Please draw the health production graph implied by this equation, for some given level of M. Pl..

  Variables cause the long run aggregate supply curve to shift

What variables cause the long run aggregate supply curve to shift? for each variable , identify whether an increase in that variable will cause the long run aggregate supply curve to shift to the left or right

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