home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX07032.CPP
- // main() function to exercise the string class
-
- // files in this example:
- // %F,15,EX0703.H%EX0703.H definition of the class PhoneBk
- // %F,15,EX07031.CPP%EX07031.CPP member functions of the class PhoneBk
- // EX07032.CPP this file -- main() to exercise this class
-
- #include "EX0703.H"
-
- void main()
- { String s1; // create an empty string s1
- s1.append("This is s1."); // add characters to s1
- String s2(12); // create s2 - up to 11 chars
- s2.append("This is s2."); // add chars to s2
- String s3("This is s3."); // create s3 - convert char*
- String s4(s3); // create s4 - copy s3
- s4.append("This is s4."); // add chars to s4
- s1.print(cout) << endl; // print s1
- s2.print(cout) << endl; // print s2
- s3.print(cout) << endl; // print s3
- s4.print(cout) << endl; // print s4
- }
-