友元函数: #include
string operator+=(string str1,string str2) {strcat(str1.s,str2.s); return str1;} void main()
{string ob1(\cout<<\cout<<\
cout<<\}
练习8(p228) 1、见教材相关内容 2、选择题
(1)B (2)B (3)C (4)A (5)B 3、写出结果(必要时上机验证) 4、填空题
(1)ofstream outfile、!outfile、outfile、outfile.close() (2)“data.dat”、outfile 5、6、
#include
fstream file(\ file.write(s1,strlen(s1)); file.seekp(0,ios::beg); while(file.get(ch)) }
cout< string(char *p=0){strcpy(s,p);} char *print(){return s;} friend string operator+=(string str1,string str2); public: