c/c++课的作业合集,都是很简单的文件。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
515 B

#include <iostream>
#include "string/String.h"
using namespace std;
// 测试示例来自题目
int main() {
String s1("Help!"),s2("Good!"),s3(s2),s4,s5;
cout<<"s1="<<s1<<endl;
s3="Hello!";
cout<<"s3="<<s3<<endl;
s3=s2;
cout<<"s3="<<s3<<endl;
s3+=s2;
cout<<"s3="<<s3<<endl;
cin>>s4;
cout<<"s4="<<s4<<endl;
s5=s3+s4;
cout<<"s5="<<s5<<endl;
s5[0]='g';
cout<<"s5="<<s5<<endl;
cout<<"strlen(s5)="<<s5.Length()<<endl;
cout<<boolalpha<<(s3 == s1)<<endl;
}