The Way To Great

通往伟大的路

z wID:zinking3
49353次访问,排名2041好友13人,关注者18
where there is a will,there is a way to great.
zinking3的文章
原创 190 篇
翻译 6 篇
转载 14 篇
评论 22 篇
Albert的公告
最近评论
强悍的沉默:辛苦了
songhuanren:不错.,很有价值,但as3的项目好像就不行了吧.
assicen:自我认为 在目前看来C/C++并非程序员必须掌握的语言 领域不同 应用不同 当然语言也不会相同
寒雨:说的不错,要想在更深入的发展,必须把基础学好,c/c++是最基础的,哥们有同感!!!知己呀··
Johnshen007:看上去相当不错,支持!
文章分类
收藏
相册
RIA的朋友们
不会飞的鱼
更新很快,关注业内的RIA朋友Y-Boy(RSS)
存档
订阅我的博客
XML聚合  FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
订阅到BlogLines
订阅到Yahoo
订阅到GouGou
订阅到飞鸽
订阅到Rojo
订阅到newsgator
订阅到netvibes

原创 【C&C++】stringstream的一些用法 - 尝试一下新的东西收藏

新一篇: 【多目标优化】Pareto最优解很少 | 旧一篇: 【C&C++】上海交大以前的一道复试题

#include <iostream>
#include 
<fstream>
#include 
<cstdlib>
#include 
<cstring>
#include 
<sstream>
#include 
<bitset>


using namespace std;


int main()
{
    
    
/*string stream tests*/
    
/*string stream for type conversions*/
//     stringstream ss;
//     string n="123.456";
//     float f=0.0f;
//     ss << n; ss >> f; cout << f <<endl;//string stream for type conversions
//     f+=333.1458f;
//     ss.clear();//多次转换之前必须将流清空
//     ss << f; ss >> n;  cout << n << endl;
//     ss.clear();

//     int a=12;stringstream ss;
//     string n;
//     ss.flags (  ios::hex | ios::showbase  );
//     ss << a;//输出0X12
//     ss >> n;//这样都可以 直接得到16进制的字符串了

//     stringstream ss;bitset<16> a(12);string n;
//     ss << a; ss >> n;
//     cout << n ; 这样就可以转为2进制的字符串了,太强了
    

    
/*stringstream ss;
    ss << "123,456";
    string s1;
    getline(ss,s1,',');//分割字符串,PARSE
    cout << ss.peek();
*/

        
    


    
return 0;
}
 

发表于 @ 2008年03月23日 14:05:00|评论(loading...)|编辑

新一篇: 【多目标优化】Pareto最优解很少 | 旧一篇: 【C&C++】上海交大以前的一道复试题

评论

#sheds 发表于2008-03-24 07:54:17  IP: 116.25.203.*
怎么不把结果贴出来呢
发表评论  


登录
Csdn Blog version 3.1a
Copyright © Albert