/* * This is a program from the book. * Many lines here */ #include #include using namespace std; const string BLACK = "%%%%%%%%"; const string WHITE = " "; const string TOP = "--------"; const char NEWLINE = '\n'; const char SIDE_BORDER = '|'; const char CORNER = '+'; int main() { string blackLine; string whiteLine; string blackBlock, whiteBlock; string topLine; // construct a black line. // |******** ********...... blackLine = SIDE_BORDER + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + SIDE_BORDER; // construct the white line. whiteLine = WHITE + BLACK + WHITE + BLACK + WHITE + BLACK + WHITE + BLACK; whiteLine = SIDE_BORDER + whiteLine + SIDE_BORDER; // construct the top border. topLine = CORNER + TOP + TOP + TOP + TOP + TOP + TOP + TOP + TOP + CORNER; // consturct the rows of squares. blackBlock = blackLine + NEWLINE + blackLine + NEWLINE + blackLine + NEWLINE + blackLine + NEWLINE + blackLine + NEWLINE; whiteBlock = whiteLine + NEWLINE + whiteLine + NEWLINE + whiteLine + NEWLINE + whiteLine + NEWLINE + whiteLine + NEWLINE; // print the results. cout << topLine << endl; cout << whiteBlock; cout << blackBlock; cout << whiteBlock; cout << blackBlock; cout << whiteBlock; cout << blackBlock; cout << whiteBlock; cout << blackBlock; cout << topLine << endl; cout << endl; return 0; }