DIGIT-ARC read-only archive · snapshot: July 23, 2026

C++ programming

3 posts · originally from https://geek.digit.in/community/threads/c-programming.30457/

vandit
vandit Original post #1
Jun 19, 2006 at 3:06 PM
cout.setf(ios::fixed,ios::floatfield)

The above was a statement which I came accross a program of doing ouput formattings. Actually I am not able to figure out its use....

I refered the E Balaguruswamy book, but no use. There was only the example given and in this example if we dont't write the above statement then also the output remains same. Even the Aptech fellow doesn't know abt this...:mad: Pls Help!

ilugd
ilugd #2
Jun 19, 2006 at 4:43 PM
could you post the next statement with cout after that? The setf member function of the cout output stream is used to set modifiers. eg. change the mode to hexadecimal output and all that stuff.

btw got this from *www.google.co.in/url?sa=t&ct=res&c...WRMm9Gbb8aLP_seoP&sig2=jOvKgC6L7RxR8DdIUjERjg

setf(ios::fixed) - output numbers of type double or float in decimal form (rather than exponential notation). This is the default in Turbo C++

also the syntax for setf is setf(flag, [mask])
floatfield is the mask or something. (Go figure). Btw try doing a google search and look up the stuff.

Hope it helps
ilugd
ilugd #3
Jun 24, 2006 at 11:01 AM
so vandit, whats up?