COMP 306 C++ Chapters 4-7 for Programmers written exam study review - Athabasca University
COMP 306 C++ Chapters 4-7 for Programmers written exam study review - Athabasca University selection structure (definition) - statement that allows the program to choose between alternative actions (make a decision) selection structure (examples) - - if - switch if statement building blocks are... - - logical expressions - actions action - a C++ statement C++ statements that can be actions - - output (cout) - input (cin) - assignment - block (compound) - placing { } around 0 or more statements forms a block; viewed by compiler as a single statement { cout "enter your age" endl; cin age; } - if (if-else), switch bool data type - - used to store a logical value - 2 logical values are true and false - reserved words: bool, true, false bool example code - bool valid, finished; ... valid = true; finished = false; logical (Boolean) expression (definition) - an expression that evaluates to true or false relational operators - operators that are used to compare values logical (Boolean) expression (facts) - - in C++, any non-zero value is considered true, 0 is considered false -logical expressions are built using relational and logical operators and operands - logical expressions are NOT stand alone statements
Written for
- Institution
- COMP 306
- Course
- COMP 306
Document information
- Uploaded on
- January 2, 2023
- Number of pages
- 6
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Also available in package deal