Note: this is is just a repeated question found under C Programming: I am very sorry, please delete the message found in C Programming.
Hello guys,
I am finding hard, what really the function to set the decimal places in two places using the compiler Borland C++ 3.0. I know already setprecission function that is found in the latest compiler such as borland c++ 4.5 or 5.5. But in Borland C++ 3.0 there is no function as setprecission found in the iomanip.h library.
I am using Borland C++ 3.0. Hope you can help me this thing.
Example:
Code:
#include <iostream.h>
#include <conio.h>
#include <iomanip.h>
int main()
{
float a, b, c, average;
clrscr();
while (a <= 3)
{
cout <<"Enter number: ";
cin >> b;
c = c + b;
a++;
}
average = c / a;
cout << average;
getch();
return 0;
}
I want to display the output into two decimal places, I know the solution using setprecission such as:
Code:
cout << average << setprecission(2);
But the problem is I could not find setprecission in Borland C++ 3.0 compiler. Thanks in advance...