Let me clarify something, Brett Viren writes: > In C++ you can also use cout.setf() to switch to, eg., scientific > notation, but CINT doesn't apparently understand this(?). Jacek Holeczek pointed out to me that cout.setf() does indeed work under CINT, but just not as written in C++PL 3rd ed. According to this, one should do, for eg: cout.setf(ios_base::scientific,ios_base::floatfield); but "ios_base" is undefined under CINT. However, as Jacek pointed out to me: cout.setf(ios::scientific); etc, works just fine. Here is the example: // junk.C #include <iostream> void junk() { double x=1.0000007; if (x > 1.0) { cout << "Error: " << x << " value is not allowed" << endl; cout.precision(10); cout << " or: " << x << " value is not allowed" << endl; cout.setf(ios::scientific); cout << " or: " << x << " value is not allowed" << endl; cout.setf(ios_base::scientific,ios_base::floatfield); cout << " or: " << x << " value is not allowed" << endl; } } root [0] .x junk.C Error: 1 value is not allowed or: 1.0000007 value is not allowed or: 1.0000007000e+00 value is not allowed Error: class,struct,union or type ios_base not defined FILE:junk.C LINE:10 Error: class,struct,union or type ios_base not defined FILE:junk.C LINE:10 Error: class,struct,union or type $ios_base not defined FILE:junk.C LINE:10 Error: Symbol scientific is not defined in current scope FILE:junk.C LINE:10 Error: class,struct,union or type ios_base not defined FILE:junk.C LINE:10 Error: class,struct,union or type ios_base not defined FILE:junk.C LINE:10 Error: class,struct,union or type $ios_base not defined FILE:junk.C LINE:10 Error: Symbol floatfield is not defined in current scope FILE:junk.C LINE:10 *** Interpreter error recovered *** -Brett.
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:53 MET