hi ,
i saw the following link http://www.cplusplus.com/reference/iostream/manipulators/setprecision/
and tried it in the same way...

#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
float a=3.14;
cout<<fixed<<setprecision(4)<<a;
}

so my output should be:3.1400.
but when i execute the above code.. i am getting the error as fixed undeclared..

What compiler are you using? Your program compiles without error using vc++ 2010 express. And this is the output

3.1400Press any key to continue . . .

Note that if you want a line feed before Press then you need to add '\n' to the cout statement.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.