|
|
|
|
|
|
|
Get Initial (Out: initial) Level 1 |
|
|
|
|
|
|
|
|
Read initial, skipping leading blanks |
|
|
|
|
|
|
|
|
|
Print Last (No parameters) |
|
|
|
|
|
|
|
|
|
Find last name
Print name |
|
|
|
|
|
|
|
|
|
|
Print Initial (In: initial) |
|
|
|
|
|
|
|
|
Find Last (Out: First character of last name) Level 2 |
|
|
|
|
|
|
|
|
|
Skip rest of first name
Read first character of last name, skipping
leading blanks |
|
|
|
|
|
|
|
|
|
|
Print Name (In: First character of last name) |
|
|
|
|
|
|
|
|
|
WHILE ch !=\n
Print ch
Read ch |
|
|
|
|
|
|
|
|
|
|
Skip First Name (No parameters) Level 3 |
|
|
|
|
|
|
|
|
|
Skip characters up to first blank |
|
|
|
|
|
|
|
|
|
|
This design goes to four levels. We can see from the design that Get Initial, Print Initial, and Skip First Name are only one line of C++ code each. (Skip First Name can be implemented as a call to the cin.ignore function.) |
|
|
|
|
|