码迷,mamicode.com
首页 > 其他好文 > 详细

第五章例题

时间:2017-07-19 14:46:09      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:out   turn   style   else   end   while   pre   iostream   space   

 

 1 #include <iostream>
 2 #include <sstream>
 3 #include <string>
 4 #include <set>
 5 
 6 using namespace std;
 7 
 8 set<string> dict;
 9 
10 int main()
11 {
12     string s,buf;
13 
14     while(cin>>s)
15     {
16         for(unsigned int i=0;i<s.length();i++)
17         {
18             if(isalpha(s[i]))
19                 s[i]=tolower(s[i]);
20             else
21                 s[i]= ;
22         }
23 
24         stringstream ss(s);
25 
26         ss >> buf; 
27         dict.insert(buf);
28     }
29 
30     for(set<string>::iterator it=dict.begin();it!=dict.end();it++)
31         cout<<*it<<endl;
32 
33     return 0;
34 }

 

第五章例题

标签:out   turn   style   else   end   while   pre   iostream   space   

原文地址:http://www.cnblogs.com/tclan126/p/7204962.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!