Friday, April 22, 2011

Lesson 15 Source Code

List of videos Lesson 15 Video
To get the full benefit of the lesson, watch the video Lesson 15: Increment and Decrement part 1 NOTE: for a fast copy, follow these steps in order:
  1. Click anywhere in a text box below (result will be a blinking vertical line in the text box)
  2. Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time) (The result should be that all the text inside the text box lights up in blue)
  3. Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish

Examples of incrementing and decrementing
The vale on the right of the assignment operator ("=") will ALWAYS be the new value of the variable that is on the left hand sign of the assignment operator. (Don't forget there can be only one variable on the left side of the assignment operator. The same rules still apply... The vale on the right hand side of the assignment operator will be the new value of the left hand side Here is a larger example of how to apply the increment and decrement technique.

Lesson 7 Source Code

List of videos Lesson 7 Video
To get the full benefit of the lesson, watch the video Lesson 7: the float and double types NOTE: for a fast copy, follow these steps in order:
  1. Click anywhere in a text box below (result will be a blinking vertical line in the text box)
  2. Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time) (The result should be that all the text inside the text box lights up in blue)
  3. Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish

Examples of the float types
The float type will display up to six significant figures The value will be dislayed in scientific notation when necessary. The float type will display 20 million in scientific notation but the the int type will not. float types do not store a lot of significant figures. Look at this code carefully. The last number printed to the screen should be 0.2 but you will get 0.1875 when its compiled.
Examples of the float types
A better version of the float type (recommended)
Now compile this code.. The correct result is displayed after changing the float types to double types.

Lesson 6 Source Code

List of videos Lesson 6 Video
To get the full benefit of the lesson, watch the video Lesson 6: Mathematical Operators NOTE: for a fast copy, follow these steps in order:
  1. Click anywhere in a text box below (result will be a blinking vertical line in the text box)
  2. Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time) (The result should be that all the text inside the text box lights up in blue)
  3. Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish

Example of the mathematical operators
Here are examples on how to apply the the addition, subtraction and multiplication. The division operator outputs different results depending on the variable type. Although 110/40 is 2.75, because these were all integer types, the result will ignore the decimal values and will use 2 as the value. The float type stores decimal values and can be used to approximate values. (There is a better type to use other than float in the next lesson) If you use arithmetic with an int type and a float type, the result will be of the type float. The mod ("%") operator is used for finding the remainder of a quotient. The mod operator can only be used for int types only. Here is an example on how to ask a second grader the quotient of two integer values.

Lesson 5 Source Code

There is no lesson 5 source code

List of videos Lesson 5 Video

Lesson 4 Source Code

List of videos Lesson 4 Video
To get the full benefit of the lesson, watch the video Lesson 4: Variables part 2: Assigning variables NOTE: for a fast copy, follow these steps in order:
  1. Click anywhere in a text box below (result will be a blinking vertical line in the text box)
  2. Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time) (The result should be that all the text inside the text box lights up in blue)
  3. Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish

A little more on Declaring and assigning variables
The main emphasis on this video is ONE AND ONLY ONE VARIABLE will go onthe left hand side of the assignment operator (=) while any other expression can go on the right hand side.The value on the right hand side will be the new value of the ONE varibale on the left hand side. Variables can be re-assigned a different value throughout different points of the program. In this example, apples and oranges will be equal to 29 because the value of the right hand side of the assignment operator In this example, apples and oranges will be equal to 29 because the value of the right hand side of the assignment operator

Lesson 3 Source Code

List of videos Lesson 3 Video
To get the full benefit of the lesson, watch the video Lesson 3: Variables part 1: Declaring variables NOTE: for a fast copy, follow these steps in order:
  1. Click anywhere in the text box below (result will be a blinking vertical line in the text box)
  2. Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time) (The result should be that all the text inside the text box lights up in blue)
  3. Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish

Declaring a couple of Integer type variables

Lesson 2 Source Code

List of videos Lesson 2 Video
To get the full benefit of the lesson, watch the video Lesson 2: The cout statement NOTE: for a fast copy, follow these steps in order:
  1. Click anywhere in a text box below (result will be a blinking vertical line in the text box)
  2. Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time) (The result should be that all the text inside the text box lights up in blue)
  3. Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish
Basic use of the cout statement
more examples of the same thing
The point of these examples is to show you that white space really doesn't matter too much about white space.