delorie.com/archives/browse.cgi | search |
Message-ID: | <38D68EC3.A651AF90@brandonsd.mb.ca> |
From: | N J Chackowsky <chackowsky AT brandonsd DOT mb DOT ca> |
X-Mailer: | Mozilla 4.7 [en] (Win95; U) |
X-Accept-Language: | en |
MIME-Version: | 1.0 |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Manipulators, where are they? |
References: | <20000317191524 DOT 04424 DOT 00000320 AT ng-fy1 DOT aol DOT com> |
Lines: | 36 |
Date: | Mon, 20 Mar 2000 20:35:51 GMT |
NNTP-Posting-Host: | 142.13.16.203 |
X-Trace: | typhoon.mbnet.mb.ca 953584551 142.13.16.203 (Mon, 20 Mar 2000 14:35:51 CST) |
NNTP-Posting-Date: | Mon, 20 Mar 2000 14:35:51 CST |
Organization: | MBnet Networking Inc. |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
This works: // Program 2.6 Experimenting with floating point output #include <iostream> #include <iomanip> using namespace std; int main () { float value1 = 0.1f; float value2 = 2.1f; value1 -= 0.09f; // Should be 0.01 value2 -= 2.09f; // Should be 0.01 cout << setiosflags(ios::fixed | ios::showpoint | ios::right); // NB cout << setprecision(14); // Change to fixed notation cout << value1 - value2 << endl; // Should output zero cout << setiosflags(ios::scientific); // NB cout << setprecision(5) ; // Return to scientific notation cout << value1 - value2 << endl; // Should output zero return 0; } RoadRaat wrote: > > Even though I include iomanip in my program, I get a message that 'fixed' or > 'scientific' is an undeclared identifier. > > I verified that iomanip is contained in my /lib directory. Why doesn't this > work? > > #include <iomanip> > etc...... > cout << fixed << area << endl; > > area is a computed value. The code successfully compiles under MS Visual C++. > Why won't it work with DJGPP? > > RoadRaat
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |