-
strange output
Why does this simple code display numbers in scientific notation?
Code:
#include < iostream >
using namespace std;
const double r = 99.95;
const unsigned short d = 2;
int main( )
{
unsigned short p;
float b;
float c;
cin >> p;
b = p * r;
c = b;
cout.precision( 2 );
cout.setf ( ios::fixed || ios::showpoint );
cout << c << endl;
cout << c / d << endl;
return 0;
}
when I remove precision and setf it works fine, but I want the formatting.
-
Code:
cout.setf ( ios::fixed | ios::showpoint );
One'|' to much.
-