I have a problem with casting; I have experience from Java where it is easy to cast and print:
int a = 1;
System.out.println((double)a);
and that code above will print 1.0.
In C++ this type of method don't work and I don't understand why.
#include <iostream>
using namespace std;
int main(){
int a = 1;
cout << (double)a;
return 0;
}
The problem is, here my output is 1 and not 1.0 like I would expect.