ios::flags

Hi, I am brand new to C++, and my teacher has given an assignment which he wants us to display values in scientific 'e' notation, but with an uppercase 'E'. He mentioned an ios::uppercase flag, which I can't get to work. Can anyone help me?
Here is what I've got so far.

#include <ios>

cout.setf(ios::uppercase) << my_value << endl;

I followed an example I found almost exactly, but the setf statement causes about 20 errors. I'm writing a Win32 console application using the visual studio.net 2003 compiler.

thanks in advance,

smtraber

[576 byte] By [smtraber] at [2007-12-16]
# 1
<smtraber@discussions.microsoft.com> wrote in messagenews:713afdb5-8286-4583-8af1-b94a4ac4c788@discussions.microsoft.com > Hi, I am brand new to C++, and my teacher has given an assignment> which he wants us to display values in scientific 'e' notation, but> with an uppercase 'E'. He mentioned an ios::uppercase flag, which I> can't get to work. Can anyone help me? > Here is what I've got so far.> > #include <ios>> > cout.setf(ios::uppercase) << my_value << endl; setf() returns void. You cannot chain output operations straight into it. Try using manipulators, like this: cout << uppercase << scientific << my_value << endl; This is equivalent to cout.setf(ios::uppercase); cout.setf(ios::scientific, ios::floatfield); // or both flags can be set in one operation // cout.setf(ios::uppercase | ios::scientific, // ios::uppercase | ios::floatfield); cout << my_value << end; -- With best wishes, Igor Tandetnik
MVPUser at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...