dimanche 27 décembre 2020

C++ error: invalid suffix '.d' on floating constant

Hello I have the following declared arrays in C++:

int arr[5] = {1,2,3,4,0};
float arr2[10] = {1.2f,0.0f,2.0f,1.4f,0.0f,4.2f,5.3f,0.0f,0.0f,0.0f};
double arr3[6] = {0.0d,0.0d,5.3d,0.0d,0.0d,0.5d};

When I compile this code the compiler returns the following error:

error: invalid suffix '.d' on floating constant

I tried compiling using the flag -std=c++11 to try and see if it worked on C++ 11 but I get the same error. Can someone tell me where the error is? Thank you :)

Aucun commentaire:

Enregistrer un commentaire