Enter the decimal value of the binary number

Assignment Help Basic Computer Science
Reference no: EM13698832

The computer generates a random sequence of 0s and 1s creating a binary number. In each round, the computer adds one more bit to the previous sequence, only displaying the added bit. The user then needs to enter the decimal value of the binary number represented by the sequence of 0s and 1s displayed so far.

At the beginning of the game, the computer asks the user to provide a number between 0 and 5 to be used as the number of mistakes allowed per game.

A mistake happens every time the user enters a wrong decimal number. When the user exhausts the number of allowed mistakes, the game terminates and the user loses.

For example, consider a game allowing 2 mistakes: the third time the user makes a mistake, the game ends and the user loses. However, if the user enters the correct decimal number, then the computer adds one more binary digit to the sequence and the game continues. Except for the new bit added at the end, the rest of the sequence remains the same as the sequence produced in the previous round. If the user manage to guess correct for 15 times, end the game by printing the user is too smart for this.

Goto and break are not allow in the loop.

Reference no: EM13698832

Questions Cloud

Print out contents of the vector : Write C++ program to provide the subsequent functionality - Ask users to enter 10 integer numbers and Print out contents of the vector.
Give the boolean equation for the problem : Develop a truth table that captures the desired circuit behavior of the problem and give the Boolean equation for the problem.
Convert to mips the following expression : The subsequent problems deal with translating from C to MIPS. Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Suppose that the base address of the arrays A and B are in registers $s6..
The value of minimal positive vector element : I need function which will evaluate. The value of minimal positive vector element - if none exists, return -1;
Enter the decimal value of the binary number : computer generates a random sequence of 0s and 1s creating a binary number. In each round, the computer adds one more bit to the previous sequence, only displaying the added bit.
Data streams and how are they used to facilitate storage : What are Java data streams and how are they used to facilitate storage and retrieval of persistent objects?
Which of insertion sort-mergesort and quicksort are stable : A sorting algorithm is described as stable if equal elements are in the same relative order in the sorted sequence as in the original sequence.
Prepare a binary to decimal memory game : The computer generates a random sequence of 0s and 1s creating a binary number - prepare a binary to decimal memory game.
What is the time complexity of the better method : Modern object-oriented software makes extensive use of the malloc and free operations. Unfortunately, they are generally quite expensive (in time) and thus efficient routines are important.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Describe object management group-s purpose-influence on uml

Investigate the Object Management Group (OMG). Discuss your findings. Describe what it is, its purpose, and its influence on UML and the object approach to systems development.

  How long will it take for the country mineral reserves

If this is so, how long will it take for the country's mineral reserves to be depleted? Solve using Excel.

  Perform the arithmetic encoding and decoding

Perform the arithmetic encoding and decoding of the following message ABBCAB$.

  Systems development quality and use case

SYSTEMS DEVELOPMENT QUALITY AND USE CASES:The purpose of SLP 5 is to get acquainted with a third modeling technique and use the output model to document the system and train users. Structure process and data models were introduced in previous modules..

  Similarity and differences between the code of c++ and java

The following is simple java program with a for loop and a simple function What is its equivalent in C++ code? Notice the similarity and differences between the code provided below to C++. Create a project and run the program and see how it runs.

  Designing an application server

Designing an Application Server

  Describe a system project that might have three subsystems

Describe a system project that might have three subsystems.

  Explain what can-t be measured can-t be effectively managed

According to the following quote "what can't be measured can't be effectively managed." The question is can everything that is important in network security be measured using metrics or any other process? Why or Why not?

  What extent do specific technologies help companies

More generally, to what extent do specific technologies help companies gain an edge over their competitors? How easy or difficult would it be to initiate such advantages

  Discuss some useful applications for n-dimensional arrays

Discuss some useful applications for n-dimensional arrays, such as graphical 3-D or biotechnology applications.

  Data mining and privacy

Data Mining and Privacy

  Demonstrates the use of the command line compiler

Write some usable code that demonstrates the use of the command line compiler to compile the code into a java.class file. Place at least one debug line in the code using a Java library utility such as print. Be sure to upload both the notepad file wi..

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