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\n",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\n");
69      } 
70      else{
71          printf("no\n"); 
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  } 
复制代码

 

posted on   cltt  阅读(221)  评论(0编辑  收藏  举报

编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示