Re: [ROOT] output format usign cout

From: Colin Bernet (Colin.Bernet@cern.ch)
Date: Tue Nov 11 2003 - 18:31:10 MET


Hello Belen, 

ios::fixed is a flag, ie an attibute of ios. When you do :
cout.fixed;
you just access it. 

to modify it :

  cout.setf(ios::fixed);
  cout<<setprecision(4);
  cout<<setw(8);
  cout<<1.235253<<endl;

btw, this flag doesn't seem to be necessary in this example. 
setprecision(4) does the job.

cheers,
Colin

On Tue, 11 Nov 2003, Belen Maria Salvachua Ferrando wrote:

> Hello,
>  
>  I have a problem, I would like to write a matrix with an especific format, I have tried to use cout.fixed
> and I have got an error message. 
> here is the part of the header file:
>  
> #include <iostream>
> #include <strstream>
> #include <iomanip>
>  
> and of the source file:
>  
> cout.fixed;
> cout<<setprecision(4);
> cout<<setw(8);
> cout<<run_corr[pmt][x][y]; cout<<"\t";
> (this inside a loop) and the error is:
>  
> /afs/cern.ch/user/b/belen/TestBeam2003/OptimalFiltering/root/weights/./Weights.C: In method `void
> Weights::NoiseMatrix (char *)':
> /afs/cern.ch/user/b/belen/TestBeam2003/OptimalFiltering/root/weights/./Weights.C:255: warning: statement
> with no effect
> 
> in line 255 I have written : cout.fixed;
>  
> Belen
> 
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET