// ;----------------------------------------------------------- // ; Program Name: Class_Demo // ; File: Demoprob5.cpp // ; Description: Demonstrates C++ String Class // ; Author: Jim Adams // ; Assignment: None // ; Environment: MS C++ 6.0 // ; Revisions: 10/02/2000 Original version // ; 07/07/2001 Added format function // ; // ;----------------------------------------------------------- #include #include using namespace std; int main(void) { string first_name, last_name; string whole_name; first_name="Allen"; last_name="Shepard"; whole_name=last_name; whole_name.append(", "); whole_name.append(first_name); cout << first_name << " "; cout << first_name.length() << " "; cout << first_name.capacity() << endl; cout << whole_name << endl; whole_name.at(7)=' '; cout << whole_name << endl; whole_name.at(7)=0; cout << whole_name << endl; }