[20478] in Athena Bugs

home help back first fref pref prev next nref lref last post

sun4 9.0.27: g++

daemon@ATHENA.MIT.EDU (Oluwaseyi Adeyemi)
Mon Jul 15 18:21:20 2002

Message-Id: <200207152221.SAA21815@m56-129-7.mit.edu>
To: bugs@MIT.EDU
Date: Mon, 15 Jul 2002 18:21:17 -0400
From: Oluwaseyi Adeyemi <oa207@MIT.EDU>

System name:		m56-129-7.mit.edu
Type and version:	Sun-Blade-100 9.0.27
Display type:		ifb

Shell:			/bin/athena/tcsh
Window manager:		sawfish

What were you trying to do?
	Compile a small c++ file to test stream manipulators

What's wrong:
	The manipulators left, right, scientific, fixed, and internal do not seem to be defined in the g++ class iostream, where as they are in gcx.  As a result, the file did not compile.

What should have happened:
	The compiled program should have simply output some numbers, demostrating the effects of some of the above manipulators.

Please describe any relevant documentation references:
	Here is the source file I was trying to compile with g++ (it worked fine with gcx):

#include <iostream>
#include <iomanip>     // For setw() and setprecision()
using namespace std;

int main()
{
  double x1 = 0.123456,  x2 = 23.987,  x3 = -123.456;
  // a)
  cout << left << setw(15) << x1 << endl;
  // b)
  cout << fixed << setprecision(2) << right << setw(12)
       << x2 << endl;
  // c)
  cout << scientific << setprecision(4) << x3 << endl;
  // Output: -1.2346e+002
  // A field width of 12 or more would be convenient!
  
  return 0;
}

home help back first fref pref prev next nref lref last post