C++ programming

Status
Not open for further replies.

vandit

In the zone
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

Beware of the innocent
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
 
Status
Not open for further replies.
Top Bottom