sec215Exam2Team2 - int Exam 2 Review It’s probably gonna...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: int Exam 2 Review () { // It’s probably gonna be lame. Lauren Bridge Katie Dropiewski Brad Jodoin Predicates; ◊ A function that returns a bool value (true or false) is called a predicate Example; bool sample(double A, double B) { A = A + B * 6; return (A >= 12) or (A<2); } What does it return when A = 2 and B = 6? Example; bool sample(double A, double B) { A = 2 + (6 * 6); return (A >= 12) or (A<2); } What does it return when A = 2 and B = 6? Example; bool sample(double A, double B) { A = 38; return (A >= 12) or (A<2); } What does it return when A = 2 and B = 6? Example; bool sample(double A, double B) { A = 38; return 1 or 0; } What does it return when A = 2 and B = 6? 1 Loops; • Loops provide the means to reach the solution to a problem by successive approximation • 2 Kinds of Loops: • For • While While Loops; int N = 5; int count = 1; int f = 1; while( count<=N ) { f = f * count; count++; } termination condition: N > count initialization loop invariant: f = N! For Loops; for(initialization1, initialization2; continuation; counter) { do something; } For Loops;...
View Full Document

This note was uploaded on 10/14/2009 for the course ENGR 101 taught by Professor Ringenberg during the Fall '07 term at University of Michigan.

Page1 / 29

sec215Exam2Team2 - int Exam 2 Review It’s probably gonna...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online