c++ problem different basics types during converting variables Yes, stupid problem, but I'm newbie in c++ and IDK what's the problem.
I have this code:
#include <iostream>
using namespace std;
int main()
{
float a = 54;
cout << a;
double(a);
cout << a;
return 0;
}
and this errors:
- error C2371: 'a' : redefinition; different basic types line 7
- error C2088: '<<' : illegal for class line 8
why it wrote: different basics types, when I converting only float to double? and what does it mean second error? what class line?
and I have this question too: Can I convert 2 variables with different basic types f.e. int to string? and is it same as converting f.e. double to float or different?