Program Layout Flashcards
1
Q
What layout depends on
A
white space
indentation
2
Q
white space
A
refers to visual space around words
made up of spaces, tabs, lines
in c++ it includes comments
3
Q
WS characters
A
SPACE characters - code no.32 in ASCII code
TAB characters - code no.9 in ASCII code
4
Q
line
A
string of zero or more characters terminated by End-Of-Line characters - Carriage Return (CR) and Line Feed (LF)
5
Q
comment types
A
End-of-line comments: introduced by //, runs to end of line
Multi-line comments: introduced by /* and terminated by */
6
Q
use of whitespace
A
- identify related pieces of code (surround em with WS)
- clarify an expression (separate pieces w/ WS)
- dont put more than one statement per line
7
Q
indentation
A
important for making C++ code more legible and understandable
8
Q
indentation rules
A
- indent using tab characters
- use chain brackets {} as indicators where to inc or dec indentation
- if statement has a subsidiary statement on next line, indent subsidiary statement by one tab
- if an if-then-else statement, give the if and else keywords same level of indentation