String

构造字符串:
#include <iostream>
#include <string.h>
using namespace std;
 
int main()
{
    string s1 = "qwertyuiopasdfghjklzxcvbnm" ;
    string s2 = s1 ;
    cout << s2 << endl ;
    string s3 (s2,1,5) ;
    cout << s3 << endl ;
    string s4 ("abcdefghjkl",5) ;
    cout << s4 << endl ;
    string s5 (10,'x') ;
    cout << s5 << endl ;
    string s6 (s1.begin(),s1.end()) ;
    cout << s6 << endl ;
    return 0;
}

 

 


posted @ 2014-10-24 23:42  NYNU_ACM  阅读(132)  评论(0编辑  收藏  举报