q1.
-You must build a binary, decimal octal to decimal converter. (up to 16-bit numbers).
-The program asks the user to select a base (H,D,O,B).
-The program asks to enter a number in the above base.
-If the number is incorrect, an error message and a return to the beginning of the program.
-The program will display this number in the various bases.
Running examples:
1.
wellcome to the online base convertor:
please enter your base to conrert from
˂′H′=Hex, ′D′=Dec, ′O′=Oct,′B′=Bin˃:
H
please enter your number:
1E3
your input was : 1E3˂H˃
the converted values are:
0000000111100011 ˂bBIN˃
000743 ˂OCT˃
00483 ˂DEC˃
convert another number ? (y/n)
2.
wellcome to the online base convertor:
please enter your base to convert from
˂′H′=Hex, ′D′=Dec, ′O′=Oct,′B′=Bin˃:
B
please enter your number:
11001111001
your input was: 11001111001˂B˃
the converted value are:
003171˂OCT˃
01657 ˂DEC˃
0679 ˂HEX˃
COMVERT ANOTHER NUMBER ? (Y/N)
3.
wellcome to the online base convertor:
please enter your base to convert from
˂′H′=Hex, ′D′=Dec, ′O′=Oct,′B′=Bin˃:
d
please enter your number:
12fg
WRONG INPUT. PLEASE TRY AGAIN.
—————————————————————
q2.
You need to create a game called ″shooting ball″.
Shooting ball/hitting ball is based on guessing and cracking. At the beginning of the game, the computer chooses a number from a number
Digits, when it is customary to choose a four-digit number, repetitions of digits are prohibited and it is customary that the number is not
will start with .0 – for example, 1234 is a valid number, 1123 and 0123 – are invalid.
Shooting ball/hitting ball takes turns when the player guesses the computer′s secret number, another
The guesser has to reveal to the guesser what the nature of his guess is by means of clues called: stamps and bullets.
Stamp – a situation where one of the digits in the guessed number is the same as the digit in the original number, and is placed correctly.
Shooting – a situation in which one of the digits in the guessed number is the same as the digit in the original number, but positioned
in a different location.
Examples: For simplicity of explanation, let′s assume that the number we are trying to guess is 1234
A player guessed 5167, they say that he has one shot, because the number 1 is present in the original number, but
is not located in the right place. The player guessed, 1567, then he has one stamp, because the number is 1
is properly located and exists in the original number. Player 5678 guessed that he doesn′t have a stamp or a hit
Because the guessed number is completely different from the original number.
Through the various guesses, the guesser is supposed to progress by trial, error and drawing conclusions, until
which will succeed in cracking the computer′s secret number. If he manages to do it in less than 13
guesses then he is crowned the winner. Otherwise – the computer wins.
The results for each guess must be displayed after each guess (on the right side of the guess) using two numbers:
The amount of ″stamps″ and the amount of ″sins″. At the end of the game you have to show how many guesses were required in order
to reach the ″shooting ball″.
Game stages:
1. The computer is waiting for a key to be pressed for the lottery (opening message)
2. The computer generates a valid number. (using the clock interrupt)
3. The user is asked to enter a 4-digit number.
4. The computer checks if the number is valid.
5. If not – an error message and returns to 2.
6. Otherwise – promote a guess counter.
7. Check stamps and damage
8. Checking for victory (terminus conditions)
9. If he won – a suitable message + how many guesses were required for success.
10. If not – check if the guessing limit has been reached (and finish if so)
11. Report stamps and damage and return to 2.
Change :
1. The drawn number – a 4-byte array
2. The guess – a 4-byte array.
3. Guess counter.
Messages :
A. Press ENTER to start playing. – 1 msg
B. Enter the four-digit guess.
third. Error message for the validity of the input number.
d. Victory message (success) + amount of guesses.
God. Notification of stamps and vulnerabilities (after each guess).
Examples of running the game:
1.
PLEASE PRESS ENRET TO START THE GAME:
PLAESE WAIT WILE COMPUTER IS CHOOSING THE NUMBERS…
PLEASE ENTER 4 DIFFERENT DIGITS AS YOUR GUESS VALUES (1-9):
1234
YOU HAVE 0 BULLS & 3 HITS
PLEASE ENTER 4 DIFFERENT DIGITS AS YOUR GUESS VALUES (1-9):
3214
YOU HAVE 1 BULLS AND 2 HITS
.
.
.
GAME OVER YOU PASSED 12 GESSES ;-˂
THE NUMBER WAS:3452
WOULD YOU LIKE TO PLAY ANOTHER GAME ? (Y/N).
N
BYE BYE (SEE YOU NEXT TIME!)
Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount