In one problem I am receiving such inputs and I need to output them as it is.
For example I will receive 5.0 as input and need to print 5.0 as output,
but it is printing 5. I used setprecision which is not working .
I think the thing is
for numbers like 2.0,3.0,4.0 it is rounding off while taking input itself.
Please help me.
See my code:
float n=5.0
// n*=1.0;
cin>>n;
cout<<setprecision(16);
cout<<n;//its printing 5 here
/*
I also tried
printf("%f",n);
//but its printing 5.000000
I can't use printf("%.1f",n)<br>
as input can be 5.234 or 4.5687 so making %.1f will not work for others
*/