2-CodeLayout

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

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

View Full Document Right Arrow Icon
Algorithms Series of mathematical or variable manipulations Integer a,b,c a = 12 b = 22 c = a * b (what is c?) 12 * 22 = 264
Background image of page 1

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

View Full DocumentRight Arrow Icon
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)
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
#include <iostream> int main( ) { std::cout<< “Hello” << std::endln; } A computer file. In your Lab work area.
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
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 Right Arrow Icon
Ask a homework question - tutors are online