1. The simplest answer is
apstring JoinStrings( apstring, apstring, apstring, apstring );
An alternative is to provide parameters, as in
apstring JoinStrings( apstring first, apstring second,
apstring third, apstring fourth );
2. The simplest solution is:
apstring JoinStrings( apstring first, apstring second,
apstring third, apstring fourth )
{
apstring result;
result = first + "*" + second + "*" + third + "*" + fourth;
return result;
}
Alternative function bodies (one line instead of three) are:
return first + "*" + second + "*" + third + "*" + fourth;
or
return first + '*' + second + '*' + third + '*' + fourth;
3. Here is a simple main program.
#include <iostream.h>
#include "apstring.h"
/* Include the function declaration and definition from parts 1 and 2 here */
int main( )
{
apstring first, second, third, fourth;
cout << "Enter four strings: " << endl;
cin >> first >> second >> third >> fourth;
cout << "The result is "
<< JoinStrings( first, second, third, fourth ) << endl;
return 0;
}