当前位置: 首页>>代码示例>>C++>>正文


C++ OStringStream::get方法代码示例

本文整理汇总了C++中OStringStream::get方法的典型用法代码示例。如果您正苦于以下问题:C++ OStringStream::get方法的具体用法?C++ OStringStream::get怎么用?C++ OStringStream::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OStringStream的用法示例。


在下文中一共展示了OStringStream::get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

	void Framework::update(){

		OStringStream o;
		o << "aho" << endl; //const char*
		char ts[ 3 ];
		ts[ 0 ] = 'O';
		ts[ 1 ] = 'K';
		ts[ 2 ] = '\0';
		o << ts << endl; //char*
		o << string( "baka" ) << endl; //string
		o << RefString( "tonma" ) << endl; //RefString
		o << 'a' << endl; //char
		o << '\n'; //char ( new-line )
		o << static_cast< char >( -74 ) << endl; //char (out of range )
		o << static_cast< char >( 14 ) << endl; //char (out of range )
		o << static_cast< unsigned char >( 99 ) << endl; //unsigned char
		o << static_cast< short >( -9999 ) << endl; //short
		o << static_cast< unsigned short >( 65534 ) << endl; //unsigned short
		o << static_cast< int >( -2012345678 ) << endl; //int
		o << static_cast< unsigned >( 4012345678 ) << endl; //unsigned

		o.precision( 7 );
		o << 50.00000000000 << endl;
		o << 0.09999999999f << endl;
		o << 0.0399999999f << endl;
		o << 1.f << endl; //float ( 1 )
		o << 1.5f << endl; //float ( 1 )
		o << 1.75f << endl; //float ( 1 )
		o << 152423.f << endl; //float ( 1 )
		o << -123456789.f * 1000000.f << endl; //float (big)
		o << -1.23456789f * 0.000000001f << endl; //float (small)
//		o.precision( 15 );
		o << -1.23456789f * 0.000000001f << endl; //float (small)
o << -134.56712839f << endl;
o << -0.056712839f << endl;
		o << 0.0 << endl; //float +0
		o << -0.0 << endl; //float -0
		o << sqrtf( -1.f ) << endl; //float NaN
		o << -1e30f * 1e30f << endl; //float +Inf
		o << 1e-30f * 1e-30f << endl; //float -Denorm
		o << -numeric_limits< float >::max() << endl; //float max
		o << numeric_limits< float >::min() << endl; //float min

		o << -123456789.0 * 1000000.0 << endl; //double (big)
		o << -1.234567890 * 0.000000001 << endl; //double (small)
		o << 0.0 << endl; //double +0
		o << -0.0 << endl; //double -0
		o << sqrt( -1.0 ) << endl; //double NaN
		o << -1e300 * 1e300 << endl; //double +Inf
		o << 1e-300 * 1e-300 << endl; //double -Denorm
		o << -numeric_limits< double >::max() << endl; //double max

		Array< char > out;
		o.get( &out );
		cout << &out[ 0 ] << endl;

		cout << o << endl;

		requestEnd();
	}
开发者ID:rainbow23,项目名称:GameLib2008,代码行数:60,代码来源:main.cpp


注:本文中的OStringStream::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。