操纵者在g ++ / gcc-2.96下表现得很奇怪 [英] manipulators act strange under g++/gcc-2.96

查看:78
本文介绍了操纵者在g ++ / gcc-2.96下表现得很奇怪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




g ++ / gcc-2.96中的操纵符似乎有问题。首先

有些没有在std ::中定义,其次,当在流上使用这个操纵器

时,它们给出了奇怪的结果。一个小的测试程序显示

它:


#include< cstdlib>

#include< iostream>


int main(int argc,char ** argv)

{

// std :: cout<< std :: fixed<< std :: showpoint<< 0.123456789<< std :: endl;

std :: cout<< std :: ios :: fixed<< std :: ios :: showpoint<< 0.123456789<< std :: endl;


退出(EXIT_SUCCESS);

}


编译并运行此程序给出了结果如下:


~ $。/ a.out

40962560.123457

~ $


任何人都知道这里出了什么问题?


提前感谢您的帮助。


Darius。

Hi,

there seems to be a problem with manipulators in g++/gcc-2.96. First
some are not defined in std:: and second, when using this manipulators
on streams, they give strange results. A small test-programm to show
it:

#include <cstdlib>
#include <iostream>

int main(int argc, char **argv)
{
//std::cout << std::fixed << std::showpoint << 0.123456789 << std::endl;
std::cout << std::ios::fixed << std::ios::showpoint << 0.123456789 << std::endl;

exit(EXIT_SUCCESS);
}

Compiling and running this programm gives the following result:

~$ ./a.out
40962560.123457
~$

Anyone got an idea whats going wrong here ?

Thanks in advance for your help.

Darius.

推荐答案

./ a.out

40962560.123457

~
./a.out
40962560.123457
~





任何人都知道这里出了什么问题?


先谢谢你的帮助。


Darius。


Anyone got an idea whats going wrong here ?

Thanks in advance for your help.

Darius.




" Darius.Moos AT esigma-systems DOT de" < PF ********* @ gmx.de>在留言中写道

news:c6 ************ @ ID-193014.news.uni-berlin.de ...

"Darius.Moos AT esigma-systems DOT de" <pf*********@gmx.de> wrote in message
news:c6************@ID-193014.news.uni-berlin.de...
你好,

g ++ / gcc-2.96中的操纵器似乎存在问题。首先
有些没有在std ::中定义,其次,当在流上使用这个操纵器时,它们会产生奇怪的结果。一个小的测试程序来显示它:

#include< cstdlib>
#include< iostream>

int main(int argc ,char ** argv)
{st / :: // std :: cout<< std :: fixed<< std :: showpoint<< 0.123456789<<
std :: endl; std :: cout<< std :: ios :: fixed<< std :: ios :: showpoint<< 0.123456789
<< std :: endl;
退出(EXIT_SUCCESS);
}
编译并运行此程序会得到以下结果:

Hi,

there seems to be a problem with manipulators in g++/gcc-2.96. First
some are not defined in std:: and second, when using this manipulators
on streams, they give strange results. A small test-programm to show
it:

#include <cstdlib>
#include <iostream>

int main(int argc, char **argv)
{
//std::cout << std::fixed << std::showpoint << 0.123456789 << std::endl; std::cout << std::ios::fixed << std::ios::showpoint << 0.123456789 << std::endl;
exit(EXIT_SUCCESS);
}

Compiling and running this programm gives the following result:

~


这篇关于操纵者在g ++ / gcc-2.96下表现得很奇怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆