#include "printWithWrap.hh" void //PrintWithWrap(const string& longString, bool reset = false, // int wrap_at_column = 65) PrintWithWrap(const string& longString, bool reset, int wrap_at_column) { static int column = 0; // keeps track of how many characters on this line if (reset) { cout << endl; column = 0; } for (int i = 0; i < longString.size(); i++) { if ((column > wrap_at_column) && isspace(longString[i])) { cout << endl; // change space to return column = 0; // re-start counter } else { // otherwise just print it normally and // keep our internal column number in sync cout << longString[i]; column++; if (longString[i] == '\n') column = 0; } } }