|
#include <afxcoll.h> //Provides Access to MFC functions
Class CDrawBox : public CObject
{
public :
// Draws the box.
void DoDraw(char * string);
}
void CDrawBox :: DoDraw(char * cValue)
{
int iCount; //Loop counter
int iSpace; //Amount of spaces to add for string.
// Draw the top of the box
fprintf(stdout,"\311");
for (iCount = 1; iCount <= 78 ; iCount ++)
{
fprintf(stdout,"\315");
}
fprintf(stdout,"\273");
// Figure out the center of the string, then display it with the box sides.
iSpace = (80 - strlen(cValue)) / 2;
fprintf(stdout,"\272");
for (iCount = 1; iCount <= iSpaces ; iCount ++)
{
fprintf(stdout," ");
}
fprintf(stdout, "%s", cValue);
// Compensate for odd sized strings, then complete the side.
if ((strlen(cValue) % 2) == 1)
{
iSpaces --;
}
for (iCount = 1; iCount <= iSpaces ; iCount ++)
{
fprintf(stdout, " ");
}
fprintf(stdout,"\272");
// |
|