Task 2C: User picks an integer in a range and computer guesses by randomly This approach is similar to Task 2B. The only difference is, the computer will generate a random integer in the range as a guess. In this strategy, a guess is a random int in a given range. Hence, for the same range and same answer, the number of guesses will be different. For example, suppose the range is in [0, 10] and the answer is 7.
These are possible outputs.
The following running takes 8 tries to get the answer.
Enter left end in range: 0
Enter right end in range: 10
User has an int in [0, 10].
Computer will guess. guess #1: 10. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 1
guess #2: 1. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 2
guess #3: 9. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 1
guess #4: 2. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 2
guess #5: 4. How is my guess? 1. too big 2. too small 3. just right
guess #6: 8. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 1
guess #7: 5. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 2
guess #8: 7. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 3 Congratulations! The answer is 7.
In the following running, it takes only three guesses to get the answer.
Enter left end in range: 0
Enter right end in range: 10
User has an int in [0, 10].
Computer will guess. guess #1: 6. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 2
guess #2: 8. How is my guess? 1. too big 2. too small 3. just right
Enter only 1, 2, or 3: 1
guess #3: The answer must be 7.
NOTE- Must be done with C++
In: Computer Science
Define the following terms and provide an example for each:
1. Population
2. Sample frame
3. Sample
4. Representative sample
In: Statistics and Probability
Define and give examples of each of the following scenarios.
1) discrete
2) continuous
3) mixed
4) dynamic
5) stochastic
In: Statistics and Probability
Which of the following reactions is NOT a pericyclic reaction?
1) epoxidation
2)eletrocyclic reaction
3) sigmatropic reaction
4) cycloadditon reaction
In: Chemistry
In: Advanced Math
What is the pathophysiology for the following conditions?
1. Pericardial effusion:
2. Myocarditis
3. Infective endocarditis
4. Mitral valve prolapse
In: Nursing
On which plates can you determine production of hydrogen sulfide?
1. HE
2. MSA
3. MacConkey
4. XLD
In: Biology
What is the oxidation number of the following elements when they form ions?
1. Se
2. Li
3. Al
4. P
In: Chemistry
n a poker hand consisting of 5 cards, find the probability of holding (a) 2 jacks; (b) 1 diamond and 4 spades.
In: Math
What would be the output of the following?
autocorrectisawful = 4
while (autocorrectisawful > 0):
print(autocorrectisawful)
if (autocorrectisawful == 2):
break
autocorrectisawful -= 1
In: Computer Science