|
|
|
|
|
|
|
Here is the program. You'll see that we have omitted the precondition and postcondition from the comments at the beginning of each function. Case Study Follow-Up Question 1 asks you to fill them in. |
|
|
|
|
|
|
|
|
//******************************************************************
// Transpose program
// This program reformats names to be in the form of last name,
// comma, blank, first initial, period. The input is in the form
// of first name, blanks, last name with one person's name per
// input line
//******************************************************************
#include <iostream.h>
void FindLast( char& );
void PrintLast();
void PrintName( char );
int main()
{
char initial; // Holds first initial
cin >> initial;
while (cin)
{
PrintLast();
cout <<, << initial << . << endl;
cin >> initial;
}
return 0;
}
//******************************************************************
void PrintLast()
// Skips the rest of the characters in the first name,
// then prints the person's last name
// Precondition: Exercise
// Postcondition: Exercise
{
char ch; // Holds first letter of last name
FindLast(ch);
|
|
|
|
|
|