#include #include int main() { const int MAXCHARS = 81; // one more than the maximum characters in a line int units = 10; float price = 36.85; char buf[MAXCHARS]; strstream inmem(buf, MAXCHARS, ios::out); // open an in-memory stream // write to the buffer through the stream inmem << "No. of units = " << setw(3) << units << " Price per unit = $" << setw(8) << setprecision(2) << price << '\0'; cout << '|' << buf << '|'; return 0; }