Hello all,
I'm new to C++ and find that there are parts in the program below which I
don't understand. If you have a look at lines nine and ten
cout << 1.e3 << endl; // 1000
cout << 1.e-3 << endl; // 0.001
Does 1.e3 mean one multiplied by a thousand, and 1.e-3 mean one multiplied by
minus a thousand?
// Program 2.3
// Floating Points Constants
#include
void main ()
{ // output
cout << 1. << endl; // 1
cout << -1. << endl; // -1
cout << 123. << endl; // 123
cout << 0.123 << endl; // 0.123
cout << 1.e3 << endl; // 1000
cout << 1.e-3 << endl; // 0.001
cout << 1.23e2 << endl; // 123
cout << 123.e-2 << endl; // 1.23
cout << 0.123456789 << endl; // 0.1234567
cout << 123456789. << endl; // 1.234567e+8
cout << 1./2. << endl; // 0.5
cout << 1./2 << endl; // 0.5
cout << 1 /2. << endl; // 0.5
cout << 1 /2 << endl; // 0
}
As you can see it is a very basic program but I would like to understand it
before I go any further so if you can help me please do.
Thanks in advance for any comments
Bye for now
Yours Spasm Robert.
---
---------------
* Origin: ROBERTS POINT (2:254/60.22)
|