Beginning Programming All-in-One For Dummies. Wallace Wang
your program until the compiler is certain that y...FIGURE 2-3: Different data types that can hold a range of values.FIGURE 2-4: Assigning a new value to a variable wipes out the old value.FIGURE 2-5: Every part of a program can access and change a global variable.FIGURE 2-6: Module variables restrict access to code stored in a particular fil...FIGURE 2-7: Subprogram variables restrict access only to code stored in that pa...FIGURE 2-8: To share data among subprograms, you have to pass that data from on...
7 Book 2 Chapter 4FIGURE 4-1: A simple IF-THEN
statement runs one extra command if something is T...FIGURE 4-2: An IF-THEN-ELSE
statement offers two different sets of commands to ...FIGURE 4-3: An IF-THEN-ELSEIF
statement offers two different sets of commands t...
8 Book 2 Chapter 5FIGURE 5-1: A loop can run one or more commands over and over.FIGURE 5-2: The WHILE
loop keeps running as long as a certain condition remains...FIGURE 5-3: A nested loop appears inside another loop.
9 Book 2 Chapter 6FIGURE 6-1: Every large program is made up of smaller subprograms that act as b...FIGURE 6-2: Reusing subprograms can make writing new programs easier and faster...FIGURE 6-3: Subprograms let you remove and isolate commands out of your main pr...FIGURE 6-4: Subprograms usually appear at the beginning or end of a file.FIGURE 6-5: When you call a subprogram, you may also need to pass parameters to...FIGURE 6-6: Normally when you pass parameters to a subprogram, the computer mak...FIGURE 6-7: Passing by reference means the subprogram can manipulate data that ...FIGURE 6-8: Recursion makes multiple copies of the same subprogram.
10 Book 2 Chapter 7FIGURE 7-1: Dividing a program into tasks can obscure the actual purpose of a p...FIGURE 7-2: Object-oriented programming divides a large program into objects th...FIGURE 7-3: The parts of a typical object.FIGURE 7-4: Changing a subprogram can wreck a perfectly working program.FIGURE 7-5: Encapsulation isolates a chunk of code as an independent object.FIGURE 7-6: If you modify a subprogram, you need to create a separate copy of t...FIGURE 7-7: Inheritance lets you reuse another object’s subprograms without phy...FIGURE 7-8: Objects contain code that’s unique to only that object.FIGURE 7-9: Polymorphism lets you reuse a method name in another object.FIGURE 7-10: An interface pattern provides an object-oriented interface to a no...FIGURE 7-11: The flyweight pattern simplifies objects that contain repetitive i...FIGURE 7-12: The memento pattern uses one object to store information about ano...
11 Book 2 Chapter 8FIGURE 8-1: A record organizes related data together.FIGURE 8-2: The fixed size of each record makes it easy to identify the physica...FIGURE 8-3: Untyped files contain records that can vary in size.FIGURE 8-4: The computer can retrieve data from an untyped file in blocks or ch...FIGURE 8-5: By defining which chunk of data you want to retrieve, you can retri...FIGURE 8-6: Database files are divided into tables, and each table is further d...FIGURE 8-7: Relational databases link tables to group logically related informa...FIGURE 8-8: Database toolkits take care of the technical details of manipulatin...FIGURE 8-9: A database toolkit can manipulate data using a familiar database la...FIGURE 8-10: Programs often act as a front end to a database file.
12 Book 2 Chapter 10FIGURE 10-1: The user interface lets you control a program, give it commands, a...FIGURE 10-2: Early user interfaces were simple menus of keystroke combinations.FIGURE 10-3: Drop-down lists help organize commands and tuck them out of sight ...FIGURE 10-4: Buttons can display the entire command name for the user to see.FIGURE 10-5: Submenus reduce the number of commands in a drop-down list but mak...FIGURE 10-6: Icons, organized in toolbars, allow one-click access to multiple c...FIGURE 10-7: Toolboxes provide another way to group icons for easy access.FIGURE 10-8: Users can type any information inside a text box, including invali...FIGURE 10-9: Radio buttons can display multiple choices, but they only let you ...FIGURE 10-10: Check boxes can display multiple choices and allow users to pick ...FIGURE 10-11: List boxes display a list of options.FIGURE 10-12: Combo boxes let you either make a choice or type data directly.FIGURE 10-13: A slider lets users visually choose a numeric value or setting by...FIGURE 10-14: A user interface displays data in a window that users can manipul...FIGURE 10-15: Dialog boxes ask the user for more data before carrying out a com...FIGURE 10-16: Boxes draw lines to separate and organize different user interfac...FIGURE 10-17: Tabs let you organize and display different user interface items ...FIGURE 10-18: This program’s drop-down list lets you view a bunch of submenus t...FIGURE 10-19: A cryptic error message is meaningless and frustrating because th...FIGURE 10-20: Customization options let a user change the user interface to sui...
13 Book 2 Chapter 11FIGURE 11-1: Code snippets can provide templates for writing common statements.FIGURE 11-2: Code completion displays several commands so you can choose the on...FIGURE 11-3: Breakpoints identify lines of code where you want the program to s...FIGURE 11-4: Conditional breakpoints can halt execution only if specific condit...FIGURE 11-5: You can often select different debugging information to use in a p...
14 Book 3 Chapter 1FIGURE 1-1: A structure can contain multiple fields.FIGURE 1-2: An array can hold multiple chunks of data.FIGURE 1-3: One-based arrays number array elements differently than zero-based ...FIGURE 1-4: Some programming languages let you define the numbering of an array...FIGURE 1-5: By defining your own numbering for an array, you can make those num...FIGURE 1-6: Resizing an array lets you expand or shrink an array.FIGURE 1-7: A two-dimensional array lets you store data in a grid.FIGURE 1-8: A structure can hold only one group of related data, but an array o...FIGURE 1-9: An array of structures acts like a simple database.FIGURE 1-10: Inserting data into an array means copying and moving data from on...
15 Book 3 Chapter 2FIGURE 2-1: Adding and removing data in a set is easier than adding and removin...FIGURE 2-2: The union
command combines data from two sets to create a third set...FIGURE 2-3: The intersection
command takes only data common in both sets and st...FIGURE 2-4: The difference
command strips out data in common with a second set.FIGURE 2-5: The order in which you list set names with the difference
command d...FIGURE 2-6: A node consists of a pointer and one or more variables to store dat...FIGURE 2-7: A linked list stores data in each node that points to another node.FIGURE 2-8: Rearranging the order of a linked list is as simple as rearranging ...FIGURE 2-9: Adding data from a linked list also involves rearranging pointers.FIGURE 2-10: Deleting data from a linked list involves removing data and then r...FIGURE 2-11: A double linked list lets you traverse a linked list in both direc...FIGURE 2-12: A circular linked list has no beginning or end.FIGURE 2-13: Pointers must always point to a valid node of a linked list.
16 Book 3 Chapter 3FIGURE 3-1: Collections expand automatically each time you store new data.FIGURE 3-2: You can insert data before a specific location in an array.FIGURE 3-3: You can insert new data after an existing location in a collection.FIGURE 3-4: When you remove data from a collection, the collection renumbers th...FIGURE 3-5: Identify data by its location or by a key.FIGURE 3-6: Retrieving data by index numbers is unreliable because they can cha...FIGURE 3-7: Hash tables make searching faster by dividing data into distinct se...FIGURE 3-8: Hash tables convert each key into a numeric value.FIGURE 3-9: Chaining lets a single hash value point to a list of multiple items...FIGURE 3-10: Double hashing creates miniature hash tables within a larger hash ...
17 Book 3 Chapter 4FIGURE 4-1: Stacks store the oldest data on the bottom and the newest data on t...FIGURE 4-2: When you add data to a stack, the oldest data keeps getting pushed ...FIGURE 4-3: The Peek command retrieves data, but the Pop
command retrieves and ...FIGURE 4-4: The Undo
command offered in most programs can be easily implemented...FIGURE 4-5: The queue data structure mimics a line of people.FIGURE 4-6: The oldest data appears at the front while the newest data appears ...FIGURE 4-7: The Peek
command retrieves data, but the Dequeue
command retrieves ...FIGURE 4-8: A deque acts like a two-way queue.FIGURE 4-9: Each node in a deque contains two pointers that point to the next a...FIGURE 4-10: Two ways to implement a deque as a linked list.FIGURE 4-11: A deque can grow in two different directions.FIGURE 4-12: A deque could be used by an antivirus program to scan messages.
18 Book 3 Chapter 5FIGURE 5-1: Modeling a map of different cities.FIGURE 5-2: A graph data structure can model the mapping problem better than an...FIGURE 5-3: The three types of graphs.FIGURE 5-4: The Seven Bridges of Königsberg represented as a graph.FIGURE 5-5: A tree is a hierarchical graph.FIGURE 5-6: A tree consists of one root node and multiple leaf and internal nod...FIGURE 5-7: A tree can organize names alphabetically by last name.FIGURE 5-8: An ordered binary tree