string

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstdio>
 4 #include <string>
 5 #include <string>
 6 #include <map>
 7 using namespace std;
 8 string s[100];
 9 int  main()
10 {
11     for(int i=0;i<5;i++){
12         cin>>s[i];
13     }
14     sort(s,s+5);//自动按字典序排序
15     for(int i =0;i<5;i++){
16         printf("%s
",s[i].c_str());
17     }
18     return  0;
19 }
20 dwqd
21 af
22 efe
23 vfg
24 df
25 af
26 df
27 dwqd
28 efe
29 vfg
 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstdio>
 4 #include <string>
 5 #include <string>
 6 #include <map>
 7 #include <utility>
 8 using namespace std;
 9 int  main()
10 {
11     /*
12      string s1;
13      cin>>s1;
14      string s2(s1);//s2=s1
15      cout<<s2<<endl;
16       
17       dwfe
18       dwfe
19 */
20     /*
21     string s1;
22     cin>>s1;
23     string  s2(s1,2);
24     cout<<s2<<endl; 
25     sdbfsgdh
26     bfsgdh
27     */
28     /*
29     char c='*';
30     string  s2(6,c);
31     cout<<s2<<endl;
32     ******
33     */
34     /*
35     string s1;
36     cin>>s1;
37     string s2=s1+"mmmm";
38     cout<<s2<<endl;
39     string s3=s1+s2;
40     cout<<s3<<endl;
41     wdfe
42     wdfemmmm
43     wdfewdfemmmm
44     */
45     /* 
46     string s1;
47     cin>>s1;
48     string  s2(s1,2);
49     string  s3=s1.substr(2);
50     string  s4=s1.substr(2,5);//(i,j-i+1):i到j 
51     cout<<s2<<endl; 
52     cout<<s3<<endl;
53     cout<<s4<<endl;
54     dfgfgnm
55     gfgnm
56     gfgnm
57     gfgnm
58     */
59     /*
60      string  s="egwrbb";
61      cout<<strstr(s,"rb");
62      cout<<strstr(s,"ll"); //有些编译器不支持 
63      */
64      /*
65      string  s1,s2;
66      cin>>s1>>s2;
67      if(s1==s2){
68          printf("yes
");
69      } 
70      else{
71          printf("no
"); 
72      }
73      */
74      /*
75      string  s;
76      cin>>s;
77      int x=s.find("lll");
78      if(x!=-1){
79          cout<<x<<endl;
80      }
81      
82      Ddaelll
83      4
84      */
85 
86     return  0;
87 }
 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     std::ios::sync_with_stdio(false);
 6     cin.tie(NULL);
 7 //    sd gvf  ebv
 8 //    sd
 9 string s;
10     getline(cin,s);
11     cout<<s<<endl;
12     return 0;
13     fvs  gsvf bgb
14     fvs  gsvf bgb
15  } 
原文地址:https://www.cnblogs.com/tingtin/p/10464376.html