set的一些用法和C中一些函数
2014-12-02 13:16
281 查看
//UVA10815
//tolower函数功 能: 把字符转换成小写字母,非字母字符不做出处理
//isalpha函数判断字符ch是否为英文字母,若为小写字母,返回2,若为大写字母,返回1。若不是字母,返回0。在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,
//
stringstream是字符串流。它将流与存储在内存中的string对象绑定起来。
在多种数据类型之间实现自动格式化。
//tolower函数功 能: 把字符转换成小写字母,非字母字符不做出处理
//isalpha函数判断字符ch是否为英文字母,若为小写字母,返回2,若为大写字母,返回1。若不是字母,返回0。在标准c中相当于使用“isupper(ch)||islower(ch)”做测试,
//
stringstream是字符串流。它将流与存储在内存中的string对象绑定起来。
在多种数据类型之间实现自动格式化。
#include <iostream> #include<set> #include<string> #include<sstream> #include<stdio.h> using namespace std; set<string>dict; int main() { // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); string word1,word2; while(cin>>word1) { int i; for(i=0;i<word1.length();i++) { if(isalpha(word1[i])) word1[i]=tolower(word1[i]); else word1[i]=' '; } stringstream ss(word1); while(ss>>word2) { dict.insert(word2); // cout<<1<<endl; } } for(set<string>::iterator it=dict.begin();it!=dict.end();it++) cout<<*it<<endl; return 0; // fclose(stdin); // fclose(stdout); return 0; }
相关文章推荐
- 去年写的测试GDAL用法的一些函数
- C++ STL中set的一些用法
- PHP 中ini_set和ini_get函数用法简介
- Oracle instr()函数的一些特殊用法
- python的一些函数用法记录
- oracle 数据库一些单行函数的简单用法
- PHP中ini_set和ini_get函数用法简介
- linux select 函数和 fd_set 用法
- sql server一些排名函数用法
- ctype.h头文件所包含的一些函数及其用法
- C#类中的get 和set 函数的具体用法
- getsockopt/setsockopt 函数用法(转)
- Matlab中一些函数及其用法列表
- NAOqi.Net(C#)MotionProxy类的一些函数用法(一)
- 一些常见函数的用法
- 关于ntext的批量修改 这个比较总要的就是一些函数的用法
- oracle 中一些独特的函数用法
- oracle中,一些独有的函数用法
- php session_set_save_handler 函数的用法(file)
- 转载: php session_set_save_handler 函数的用法(mysql)