Friday, April 22, 2011

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.

1 comment:

  1. So in other words I can use the double instead of the "float" and the "int".

    ReplyDelete