So, I\'m working on a C++ project. I have a var of long double type and assigned it a value like \"1.02\"
Then, I try to use cout to print it and the result is: -0>
This is an easier method, but your program worked on my compiler.
#include
#include
#include
using namespace std;
int main(int argc, char** argv)
{
std::setprecision(10);
long double var = 1.023563457578;
cout << var << endl;
return 0;
}
I hope this helps you see that your compiler might actually have a problem.
Source - > Link