#define mCONSOLE
#ifdef mCONSOLE
#include <iostream>
typedef std::ostream xstream;
#else
#include <fstream>
typedef std::ofstream xstream;
#endif
void mprint(xstream& fp, const char* s, int N, int cx, int cy) {
int x, y, a, b = cy / 2;
for(y = 0; y <= cy * N; y++) {
if(!(y % cy)) {
for(x = 0; x <= cx * N; x++)
fp << '-';
fp << std::endl;
} else {
fp << '|';
a = cx / 2;
for(int i = 1; i <= cx * N; i++) {
if(*s && y == b && i == a) {
fp << *s++;
a += cx;
continue;
}
fp << ((!(i % cx)) ? '|' : ' ');
}
fp << std::endl;
}
if(y == b)
b += cy;
}
}
int main(void)
{
mprint(std::cout, "DOGCATFOX", 3, 10, 6);
return 0;
}