>I don't understand what's wrong with assigning the value 0.1 to a float variable .
There's nothing wrong with it, the compiler is warning you that you are trying to assign a double to a float.
A literal 0.1 is a double in your compiler.
Do a test. Add these printf(s) to your snippet.
I know that this thread is a year old but I just hod to comment.
I am just trying to learn C++ on my owna nd picked up a book. One of the examples in the book for building your own structures is as follows:
//structur.cpp -- a simple sructure
struct inflatable //structure declaration
using namespace std;
inflatable guest =
"Glorious Gloria", //name value
1.88, //volume value
29.99 //price value
}; //guest is a structure variable of the type inflatable
// its initialized to the indicated values
this gave me the exact same compile errors posted here. So I googled the error and was brought here. From this thread I attempted to change the code by adding the "f" to show the value is a float and it worked! Thanks guys!