5C PROGRAM |
|
ThatsShocking
Write a program that reads in a single character input and outputs the corresponding binary number based on its ASCII value.
TEST DATA:
INPUT: &
OUTPUT: 00100110
INPUT: m
OUTPUT: 01101101
Write a program that reads in a single character input and outputs the corresponding binary number based on its ASCII value.
TEST DATA:
INPUT: &
OUTPUT: 00100110
INPUT: m
OUTPUT: 01101101
BinaryQuiz
For 2 points:
Write a program that will randomly generate a byte (eight digits of a binary number) and ask the user to convert it to decimal form. The user gets to continue playing until they get one wrong. Tell the user how many he/she got correct.
For 3 Points:
Make this a two-player game to see who can last longer. Declare a winner at the end. Follow the "Spelling Bee" rules to determine a winner; if the first player misses, then the second player must get it right to win.
For 4 Points:
Make this a two-player game AND make the questions alternate between binary-->decimal and decimal-->binary.
PLEASE INDICATE WHICH OPTION YOU SELECTED IN THE DROPBOX.
For 2 points:
Write a program that will randomly generate a byte (eight digits of a binary number) and ask the user to convert it to decimal form. The user gets to continue playing until they get one wrong. Tell the user how many he/she got correct.
For 3 Points:
Make this a two-player game to see who can last longer. Declare a winner at the end. Follow the "Spelling Bee" rules to determine a winner; if the first player misses, then the second player must get it right to win.
For 4 Points:
Make this a two-player game AND make the questions alternate between binary-->decimal and decimal-->binary.
PLEASE INDICATE WHICH OPTION YOU SELECTED IN THE DROPBOX.
ABC: HDB-Convert (+2)
There are other number systems with different bases besides our decimal (base 10) and binary (base 2). The hexadecimal system has base 16 (hexa = 6 + deci = 10). These numbers are prominently used in HTML code to develop webpages. Try this!
You can learn more about "hex" numbers here.
Write a program that asks the user if he/she wishes to convert a hex, decimal, or binary number. Allow the user to enter the number and test to see if it is valid. For example, binary can only have 1 and 0, decimals can have only 0-9, etc. Then, show the number converted into the OTHER two forms.
TEST DATA:
Input: Decimal 10
Output: Binary 1010 Hex 00000A
Input: Binary 10110010
Output: Decimal 178 Hex 0000B2
Input: Hexadecimal 6C22B1
Output: Decimal 7086769 Binary 011011000010001010110001
There are other number systems with different bases besides our decimal (base 10) and binary (base 2). The hexadecimal system has base 16 (hexa = 6 + deci = 10). These numbers are prominently used in HTML code to develop webpages. Try this!
- Right click on this page and "view page source".
- Strike CTRL+F to engage the 'find' function, and search for this: <font color=
- See the #_ _ _ _ _ _ that follows? Those six letters/numbers are a hexadecimal code used to represent the font color.
You can learn more about "hex" numbers here.
Write a program that asks the user if he/she wishes to convert a hex, decimal, or binary number. Allow the user to enter the number and test to see if it is valid. For example, binary can only have 1 and 0, decimals can have only 0-9, etc. Then, show the number converted into the OTHER two forms.
TEST DATA:
Input: Decimal 10
Output: Binary 1010 Hex 00000A
Input: Binary 10110010
Output: Decimal 178 Hex 0000B2
Input: Hexadecimal 6C22B1
Output: Decimal 7086769 Binary 011011000010001010110001