MECH 215 Lecture Notes - Lecture 3: Switch Statement, Operand, Bit Field
Document Summary
Up to now, all of the programs we have seen were examples of what is known as straightline programming. Program execution commenced with the first statement and proceeded statement by statement until the end of the program was reached. Most non-trivial programs require some sort of mechanism to alter the sequence of statement execution. C++ has two conditional constructs and three looping constructs. The conditional constructs determine which statements are to be executed depending upon a certain condition, the looping contructs determine the number of times a block of statements is to be executed. In the original version of the c programming language a. Logical false was represented by the integer value 0, a logical true was represented by any non-zero integer. Thus in c (and early versions of c++) the following were all legal ways of representing a logical true: Similarly, the following are legal ways of expressing a logical false.