long double m;
cout << \"enter double: \"; cin >> m;
cout << \"m = \" << m <
Input:
enter double: 1.546
You have read the whole value of the double. The problem is with the cout. It by default rounds the value to 6 digits after the decimal point.
To set the precision cout uses, use setprecision
from <iomanip>
:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
long double d;
cin >> d;
cout << setprecision(10) << d << endl;
return 0;
}