Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #5937

Re: basic_ostream question

From red floyd <no.spam.here@its.invalid>
Newsgroups comp.lang.c++
Subject Re: basic_ostream question
Date 2011-05-31 21:50 -0700
Organization A noiseless patient Spider
Message-ID <is4gfl$b94$1@dont-email.me> (permalink)
References <is45j3$s8u$1@reader1.panix.com>

Show all headers | View raw


On 5/31/2011 6:45 PM, Ruben Safir wrote:
> can simeone explain why the last 3 lines don't behave like expected
>
> #include<iomanip>
>
>
> int main(int argv, char ** argc){
>
>     char x = 'm';
>     float a = 3.14, b = 9.3453, e = 3, f = 1/3;
>     f = (1.0 / 3);
>     short c = 6;
>     std::cerr.write( "x = ", 4);
>     std::cerr.put(x);
>     std::cerr.put( '\n');
>     std::cerr<<  "x = "<<  x<<  std::endl;
>     std::cout<<  "a + b + c = "<<  std::scientific<<  a + b + c<<  " hello World"<<  std::endl;
>     std::cout<<  "a + b + c = "<<  std::fixed<<  a + b + c<<  std::endl;
>     std::cout<<  "e * f  = "<<  e<<  " * "<<  f<<  "="<<  e * f<<  std::endl;
>     ((std::cout.write("x= ", 3)).operator<<(x)).operator<<(std::endl);
>     ((std::cout.operator<<("x= ")).operator<<(x)).operator<<(std::endl);
>     std::cout<<  "x = "<<  x<<  std::endl;
> }
>

Ignoring the missing #include <iostream>, exactly how were you
expecting it to behave, and what did you see instead?

Please see FAQ 5.8

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

basic_ostream question Ruben Safir <ruben@mrbrklyn.com> - 2011-06-01 01:45 +0000
  Re: basic_ostream question red floyd <no.spam.here@its.invalid> - 2011-05-31 21:50 -0700
    Re: basic_ostream question ruben safir <ruben@mrbrklyn.com> - 2011-06-02 22:44 -0400
      Re: basic_ostream question Michael Doubez <michael.doubez@free.fr> - 2011-06-03 02:56 -0700

csiph-web