216 C++ Seasoned pro #include stream.h const int MAXLEN = 80 class outstring class outstring { private: int size char str[MAXLEN] public: outstring() { size=0 } ~outstring() {size=0 } void print() void assign(char *chrs) } void outstring::print() { int i for (i=0 i size i++) cout str[i] cout "\n" } void outstring::assign(char *chrs) { int i for (i=0 chrs[i] != '\0' i++) str[i] = chrs[i] size=i } main (int argc, char **argv) { outstring string string.assign("Hello World!") string.print() } Manager “George, I need a program to output the string ‘Hello World!’”
The Evolution of a Programmer 217
Previous Page Next Page