Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USE THE PROGRAMMING IN C LANGUAGE AND ENSURE THAT THE CODING HAS NO ERRORS WHEN RUN ON A MAC. You are required to write

image text in transcribed

PLEASE USE THE PROGRAMMING IN C LANGUAGE AND ENSURE THAT THE CODING HAS NO ERRORS WHEN RUN ON A MAC.

You are required to write a program that implements a simple game. The game involves a user guessing a number. The program is based on a text file numbers.txt that stores 55 integer numbers comprised within the interval from 12 to 112 The game starts by asking the name of the player and a position for a secret number within the file numbers.txt. This position is a number between 1 and 55 that corresponds to a number within the file, so that the player cannot know this initial secret number. Then the objective is for the player to guess this secret number in a series of guesses. The program should take a number input from the player via the keyboard. If this number as guessed by the player is the secret number then the player wins. Otherwise the computer should indicate whether the guess is lower or higher than the secret number (but do not reveal what this number is!). The computer should keep asking the player, providing indications on whether the guess is lower or higher than the secret number, until the user correctly guesses the secret number. Finally, depending on the number of attempts needed by the user to guess the secret number, the program should display one of the following messages: "You are too lucky!!!" - If the user guesses the secret number in the 1t attempt. "Excellent!!"-If the user guesses the secret number in the 2 nd or 3rd attempt. "Good!"- If the user guesses the secret number in the 4h or 5t" attempt "Ok" - If the user needs 6 or more attempts to guess the secret number. Also, the play history of past games (player name, secret number and number of attempts) for all players should be saved in a single file. Previously saved games can be read from the file and shown in the screen with the aid of a menu where the user can chose between showing e previous play history or playing a new game

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

What is cultural tourism and why is it growing?

Answered: 1 week ago