2-CodeLayout

# 2-CodeLayout - Algorithms Series of mathematical or...

This preview shows pages 1–6. Sign up to view the full content.

Algorithms Series of mathematical or variable manipulations Integer a,b,c a = 12 b = 22 c = a * b (what is c?) 12 * 22 = 264

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
An example…. Describe how to tie a shoe… How to text message someone… Give a pill to a dog… They are all instructions that have "repeats" and "retries" (called iterations) and "if this" and "do that" (called conditionals)
Programs: Complicated, Concatenated Algorithms integer Total, LoopCounter Total = 0 LoopCounter = 0 Start: Add 2 to Total Add 1 to LoopCounter Go Back to Start Until Total = 12 What is LoopCounter? done Total: 2 4 6 8 10 12 LoopCounter: 1 2 3 4 5 6 test for Total=12, done here

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Written in “Code” int LoopCounter , Total ; LoopCounter = 0 ; Total = 0 ; while ( Total < 12 ) { Total = Total + 2 ; LoopCounter = LoopCounter + 1 ; } semicolon open bracket odd-looking algebra no semicolon (because brackets follow) close bracket
#include <iostream> int main( ) { std::cout<< “Hello” << std::endln; } A computer file. In your Lab work area.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 12/05/2011.

### Page1 / 20

2-CodeLayout - Algorithms Series of mathematical or...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online