Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ #include using namespace std; do so. int main() { // TASK 1 (6 pts): Create four variables. If any need to be //

image text in transcribedimage text in transcribedin c++

#include using namespace std; do so. int main() { // TASK 1 (6 pts): Create four variables. If any need to be // initialized // Variable 1 will store an integer from 1 to 100. This will be a // constant that you will use to store a secret number. Make this Il a constant and initialize it to a secret number of your choosing. // This is the number that the player playing your game will be trying // to guess. // Variable 2 will store an integer from 1 to 100. This will be // used to store the current guess of the player. // Variable 3 will be a counter that tracks how many turns it took // the player to guess the right answer. // Variable 4 will be a string that will store the players name. // TASK 2 (3 pts): Write the correct code to ask for the player's // name. Remember, their name may have a space, so collect // the name appropriately. do { // TASK 3 (2 pts): Remind the player of how many guesses // they have made so far. // TASK 4 (3 pts): Ask the player to guess a number and store their // response into your guess variable. // TASK 5 (6 pts): Write an input validation Loop that checks to // TASK 4 (3 pts): Ask the player to guess a number and store their // response into your guess variable. // TASK 5 (6 pts): Write an input validation Loop that checks to // verify that it is Legal (between 1 and 100). The player should // be able to re-enter until it is valid. // TASK 6 (3 pts): Tell the player whether their guess is // too high or too low. Or - if it is correct - tell them that. // TASK 7 (2 pts): Unless the player was correct, increment the // counter by 1. 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 // TASK 8 (2 pts): Finish the do-while Loop that will run the code as // long as the guess doesn't equal the secret number } while (/* REPLACE THIS COMMENT WITH TASK 8 CODE */); // TASK 9 (3 pts): Congratulate the player (by name) on finishing the game // and remind them of their score. // TASK 10 (5 pts): Write a fall through switch statement that adds the // following statements if the following are true: // "OUTSTANDING" - if it took 1, 2, or 3 guesses // "REALLY GOOD" if it took 4 guesses // "NICE JOB" - if it took 5 guesses // and nothing else if it took 6 or more } 62 63 64 65 66 67 68

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

Students also viewed these Databases questions