At the end of this lesson, you will be able to:
understand and use an associative array
lists
from the online book Computer Based Problem Solving by Patrick Coxall, read:
Associative Array
also called a dictionary, map, symbol table
collection of key-value pairs
each key only appears ONCE in the collection
each key can only have 1 value
the key is the phone number
the name is the value
each phone number can only correspond to 1 name
Create a program called “Unicode”. Unicode is an encoding table for all the characters in the world. We will only focus on the Latin alphabet (‘A’ to ‘Z’, ‘a’ to ‘z’) including special characters like spaces, periods, etc.
In main():
It loads the unicode character set (a subset of it, just the basic Latin characters) into an associative array.
It then asks the user to enter a string.
It calls a function called “display_in_hex()” in Python and “displayInHex()” in C++ .
In the function “display_in_hex()” in Python and “displayInHex()” in C++:
It accepts 2 parameters: the user string and the Unicode dictionary
It displays the list of hexadecimal values that are the Unicode for each character in the string.
In C programming language, a Hexadecimal number is represented by preceding with "0x”. For example:
‘A’ is 0x41
‘Z’ is 0x5a
‘a’ is 0x61
‘z’ is 0x7a
‘ ‘ is 0x20
Ensure the main() function catches any "bad" user input so that only "valid" input is passed to the function.
Note: The top-down design should be for the entire program. There should be a flowchart for each function.
in groups of 2, do the following on the board for today's daily assignment:
Top-Down Design
Flow Chart
Pseudocode
Test Cases
complete the Daily Assignment section in Hãpara Workspace for this day
if Hãpara is not working, make a copy of this document
move it to your IMH-ICS folder for this course
recreate the same program in C++