Find Jobs
Hire Freelancers

Guessing Game

$25-30 USD

Terminado
Publicado hace alrededor de 20 años

$25-30 USD

Pagado a la entrega
This assignment requires the use of random numbers. You must include the <cstdlib> and <ctime> header files to allow access to rand() and srand(), respectively. These will be discussed in class. The program will implement a “guessing game.?? Ask the user for a number in the range of 1 through 100, inclusive. If the guess is larger than the random number you generated in the range of 1 through 100, inform the user that the guess was too high. If the guess is too low, say so, and when the guess matches the random number, say so! Also, tell the user how many guesses were required. What should you do if the user inputs an invalid guess? Suppose the user enters 0 or 200? You should allow only valid guesses. Therefore, keep asking for guesses until the user enters a number between 1 and 100, inclusive. Run the program 3 times and print the results (note: be sure to use some invalid guesses to test that part of your logic). Remember to print an error message (with the number) when an invalid guess is made. Code a function named, guess(), that will return a number in the range 1 to 100, inclusive. As discussed in class, the function, rand(), will return a random number in the range 0 to MAX, where MAX is a predefined constant (maybe 32767, or ??). Obviously, you must modify the random number to be in the range from 1 to 100, inclusive. Also, random numbers are generated using “seed?? values. Unless you change the seed each time the program is executed, the program will generate the same sequence of random numbers. This makes the game trivial once the user realizes that the random numbers are always the same! To avoid this problem, use srand() to “seed?? the random number generator. You use srand() only once in your program (not in a loop!) to change the seed value. This will cause the program to generate a different sequence of random numbers each time the program is executed! The exact function invocation is: srand(time(NULL)); //use the system clock to generate a seed Code the program to allow the user to play the game multiple times and display the average number of guesses at the end of the game. Suppose the user played the game 5 times and the number of guesses for each game was: 7, 4, 5, 5, and 8. The average number of guesses would be: 5.80. Also, allow the user to enter either an uppercase Y or a lowercase y to continue with another game! ## Deliverables 1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. 2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables): a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment. b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform Must be written in Microsoft Visual c++ Windows 2000
ID del proyecto: 3155018

Información sobre el proyecto

35 propuestas
Proyecto remoto
Activo hace 20 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
See private message.
$17 USD en 4 días
4,8 (38 comentarios)
4,7
4,7
35 freelancers están ofertando un promedio de $13 USD por este trabajo
Avatar del usuario
See private message.
$8,50 USD en 4 días
5,0 (99 comentarios)
7,0
7,0
Avatar del usuario
See private message.
$25,50 USD en 4 días
5,0 (23 comentarios)
6,3
6,3
Avatar del usuario
See private message.
$17 USD en 4 días
4,9 (193 comentarios)
6,5
6,5
Avatar del usuario
See private message.
$4,25 USD en 4 días
5,0 (11 comentarios)
6,5
6,5
Avatar del usuario
See private message.
$12,75 USD en 4 días
4,9 (212 comentarios)
5,8
5,8
Avatar del usuario
See private message.
$12,75 USD en 4 días
5,0 (64 comentarios)
5,5
5,5
Avatar del usuario
See private message.
$17 USD en 4 días
4,8 (28 comentarios)
5,1
5,1
Avatar del usuario
See private message.
$21,25 USD en 4 días
5,0 (61 comentarios)
5,1
5,1
Avatar del usuario
See private message.
$16,15 USD en 4 días
5,0 (126 comentarios)
4,7
4,7
Avatar del usuario
See private message.
$17 USD en 4 días
4,9 (47 comentarios)
4,6
4,6
Avatar del usuario
See private message.
$17 USD en 4 días
5,0 (10 comentarios)
4,1
4,1
Avatar del usuario
See private message.
$25,50 USD en 4 días
5,0 (22 comentarios)
4,2
4,2
Avatar del usuario
See private message.
$21,25 USD en 4 días
5,0 (9 comentarios)
4,1
4,1
Avatar del usuario
See private message.
$12,75 USD en 4 días
5,0 (9 comentarios)
3,5
3,5
Avatar del usuario
See private message.
$12,75 USD en 4 días
5,0 (42 comentarios)
3,7
3,7
Avatar del usuario
See private message.
$8,50 USD en 4 días
4,9 (24 comentarios)
3,5
3,5
Avatar del usuario
See private message.
$8,50 USD en 4 días
4,9 (42 comentarios)
3,4
3,4
Avatar del usuario
See private message.
$6,80 USD en 4 días
5,0 (15 comentarios)
3,3
3,3
Avatar del usuario
See private message.
$11,90 USD en 4 días
5,0 (6 comentarios)
2,9
2,9
Avatar del usuario
See private message.
$6,80 USD en 4 días
5,0 (15 comentarios)
3,1
3,1

Sobre este cliente

Bandera de UNITED STATES
Tracy, United States
5,0
2
Miembro desde abr 1, 2004

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.