Week 2
Monday
No Class in Spring Semester
MLK Day
Tuesday
Review "what is it #1 & #2 flowcharts"
Dream Spark - MS Software
data vs programs (programs are instructions run by the processor, data are values used by the programs, they are both just bytes)
programming languages & generations
Compile - translate to machine language
Compiler - program that compiles
syntax - how symbols are combined to form valid expressions
semantics - meaning of the symbols that form an expression
language - symbols with semantic meaning and syntax used to write instructions for the computer
Language Generations
Low
   1st - Machine   (.exe files in windows)
   2nd - Assembly
High
   3rd - High Level  (c++ is here)
   4th - Very High Level          
 
IDE - Integrated Development Environment
   Compiler, code editor, Debugger, Help system
 
Intro to C++ syntax
#include<iostream>
using namespace std;
void main() {}
literal - a number such as 45 or a word such as "Bob" that is not a variable
// - begins a comment line in c++
# - lines that begin with this are instructions to the compiler (aka, compiler directive)
brief introduction to variables
writing to output stream... cout << 
reading from input stream... cin >>
>> - stream extraction operator
<< - stream insertion operator
cascading << 
Examples
Homework
Prime Factors Flowchart (Due Thursday)
Read chapters 1 from Schaum
 
Wednesday
Review Tuesday
____________________
declaring variables
data types
short - 2 bytes, no decimals
int - 4 bytes, no decimals
float - 4 bytes, with decimals
double - 8 bytes, with decimals
bool - 1 byte, true or false
_______________
cin >>  - reads until white space
   example - 1 2 3 4 5 - entered into the input stream
cascading >> 
_______________
conditional statements - if, if-else, if-else-if control structures
if  - one way choice
if else  - two way choice
accidental use of a ";" at the end of an if statement
_______________
Examples
Assign Homework
Valid Date C++ Program   (Due Friday)   
Read chapters 2 from Schaum
 
 
Thursday
Review
declaring variables
data types
short - 2 bytes, no decimals
int - 4 bytes, no decimals
float - 4 bytes, with decimals
double - 8 bytes, with decimals
bool - 1 byte, true or false
______________
Integer vs. Floating point Division
integer division - decimals are lost
% - modulas operator - used to find remainders of integer division
_________________________________
use of {} with conditions   
if-else-if
 
when can nested if-else structures be turned into if-else-if structures
___________________________________
logical and &&
logical or ||
use ! (aka not) to negate a boolean expression
_______________
while
"I will not talk in class" example
#include <iomanip> 
++  increment operator
--  decrement operator
Examples
Assign Homework
Is Prime (Due Monday)
Read chapters 3 from Schaum
 
Friday
nested loops
do while
determinate(counted) vs indeterminate loops
data validation loops
Controlling decimal number output
  1. cout.setf(ios::fixed) makes all floating-point numbers display their decimal points (no scientific notation)
  2. cout.precision(places) rounds the decimal places to a given number. When the precision that is set causes some digits to not be shown, those that are displayed are rounded.
 
Controlling the width of the next item to be displayed
  • cout << setw(4) << value;
Example
Falling Object (example of setw and precision)
Assign Homework
Read chapters 4 from Schaum
Assign Project
Credit Card Project (Due Wednesday)