Program Layout Flashcards

1
Q

What layout depends on

A

white space

indentation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

white space

A

refers to visual space around words
made up of spaces, tabs, lines
in c++ it includes comments

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

WS characters

A

SPACE characters - code no.32 in ASCII code

TAB characters - code no.9 in ASCII code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

line

A

string of zero or more characters terminated by End-Of-Line characters - Carriage Return (CR) and Line Feed (LF)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

comment types

A

End-of-line comments: introduced by //, runs to end of line

Multi-line comments: introduced by /* and terminated by */

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

indentation

A

important for making C++ code more legible and understandable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly