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

  Personal training services-demand and cost parameters

A small fitness center that offers only personal training services has the following demand and cost parameters: Demand: The fitness center has found that it has some discretion in pricing¬¬—that is, it can raise price marginally without drastic redu..

  Procedure necessary to solve for equilibrium analytically

Describe the procedure necessary to solve for equilibrium analytically. Show how this translates in an economy with an Edge worth box. If you have a demand curve as part of your solution method you should explain how it is derived from consumer and/o..

  Illustrate what happens to money supply-interest rates

Illustrate what happens to money supply, interest rates and economy in general if Federal Reserve is a net seller of government bonds.

  Investment expenditures and government purchases

Suppose that consumption expenditures, investment expenditures, and government purchases are 75 billion, 25 billion and 20 billion, respectively. How large should the GDP be so that the net export is zero?

  Quantity demanded of wool sweaters

Last winter, the price of home heating oil increased by 20% and the quantity demanded of home heating oil decreased by 2%. At the same time, with no change in the price of wool sweaters, the quantity demanded of wool sweaters went up by 10%.

  Inflation expectations in korea compared to the us

Elucidate what does this indicate concerning inflation expectations in Korea compared to the US.

  Qbriefly explain the current 2012 discretionary fiscal

q.briefly explain the current 2012 discretionary fiscal policies that are being used by the federal government to try

  Explain what the identity means

Consider the identity S p−I = CA+D where S p is private sector saving, I is investment, CA is the current account surplus, and D is the government deficit.  Show the above identity holds. Explain what the above identity means.

  What are some other potential sources of economic growth

Look at the differences in per capita GDP growth of the following countries in 2006: What factors, such as international trades, might explain such differences in per capital GDP growth rates? What are some other potential sources of economic growth?

  Rating agency standard and poor downgraded

On Friday, August 5, 2011, the rating agency Standard and Poor's downgraded the U.S, from AAA to AA+. However, the other major rating agencies -- Moody's and Fitch -- retained the AAA status for the U.S.

  Impossible trinity of international macroeconomics

Economists sometimes refer to the attempt by countries to fix their exchange rates, control thier money supply, and operate with open capital accounts in their balance of payments (that is , to have no restrictions on capital movements) as the "impos..

  What is the amount of frank monthly payment

What is the amount of Frank's monthly payment?

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