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 @   NYNU_ACM  阅读(132)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示