以文本方式查看主题 - 计算机科学论坛 (http://bbs.xml.org.cn/index.asp) -- 『 C/C++编程思想 』 (http://bbs.xml.org.cn/list.asp?boardid=61) ---- [讨论]关于对字符串中各单词按字母顺序排序的问题 (http://bbs.xml.org.cn/dispbbs.asp?boardid=61&rootid=&id=63092) |
-- 作者:tianzhaoling -- 发布时间:5/27/2008 10:29:00 AM -- [讨论]关于对字符串中各单词按字母顺序排序的问题 在网上看到一段代码,其作用是把一个字符串中各单词按字母表顺序进行排序,并在排序后输出,这段代码比自己写的要简短得多,有朋友还有更简洁的实现方法么? void main() char source[] = "Most websites and web applications run smoothly and correctly as long as only one user e.g." char *t = strtok(source," "); while(t) { for(int i=0,p=words.size()-1,sub=words.size()-1; i<sub; ++i,--p) } copy(words.begin(),words.end(),ostream_iterator<char *>(cout,"\n")); |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
31.250ms |