COMPTNG 10A Study Guide - Midterm Guide: Short-Circuit Evaluation, Lexicographical Order, Infinite Loop

55 views2 pages
14 Sep 2017
School
Professor

Document Summary

Midterm study guide input/output (i/o) & flow control. We provide info. to the program via keyboard/mouse/microphone/other devices. Program uses monitor, speaker, and other devices to return info to us humans. ^ can also be for machine to machine communication. Putting something into your code rather than taking it in as an input (via cin) Control structures allow programs to follow a more complicated flow. Logical operators are && (and), || (or), and ! (not) Infinite loop = loop that will never end (usually bug) When the iteration index of a loop is off by 1. Usually from [0 to n 1] to [1 to n] Continue = skips the remaining part of the loop and continues to the next iteration. Not (a or b) = not a) and (not b) && and || implement short-circuit evaluation the 2nd (cid:271)ool is(cid:374)(cid:859)t e(cid:448)aluated if the 1st bool determines the output. Declaration (string s; int j = 0;)