Sunday, January 8, 2012

String Part2





Running Codes
#include
#include
using namespace std;

int main()
{
string s1;
string s2("345");
string s3("678");
s1=s2;
cout << s1 << endl;
s1="012";
cout << s1 << endl;
s1=s1+s2+s3;
cout << s1 << endl;
s1+="9";
cout << s1 << endl;
s1.insert(0,s1);
cout << s1 << endl;
s1.insert(0,"abc");
cout << s1 << endl;
s1.erase(0,3);
cout << s1 << endl;
s1.replace(0,1,s1);
cout << s1 << endl;
cout << s1.at(0) << endl;
cout << s1.find("456") << endl;
cout << s1.substr(9,8) << endl;
return 0;


}

http://pages.cs.wisc.edu/~cs368-1/CppTutorial/NOTES/STRING.html

No comments:

Post a Comment