I'm new to programming so please forgive me is this is a daft question!
On working my way thru a book on C++ i tried an exercise as follows:
"declare a constant for pi as 3.14159 then declare a float variable and initialize it using your pi constant."
this was my solution:
const float pi = 3.14159;
float testPi = pi;
I included a print statement to test and compiled (i'm using MS Visual C++ 6) the compiler gave me no errors but the following warning:
'initializing' : truncation from 'const double' to 'const float'
Can anybody out there tell me what this means?
On working my way thru a book on C++ i tried an exercise as follows:
"declare a constant for pi as 3.14159 then declare a float variable and initialize it using your pi constant."
this was my solution:
const float pi = 3.14159;
float testPi = pi;
I included a print statement to test and compiled (i'm using MS Visual C++ 6) the compiler gave me no errors but the following warning:
'initializing' : truncation from 'const double' to 'const float'
Can anybody out there tell me what this means?