0
[help] why the output is false??
#include<iostream> using namespace std; int main() { double a = 0.1; double b = 0.2; double c = 0.3; if (a+b == c) cout << "true" << endl; else cout << "false" << endl; system("pause"); return 0; }
2 ответов
0
Add iomanip header file...And write this..
int main()
{
double a=0.1;
double b=0.2;
double c=0.3;
cout<<setprecision(20)<<a+b<<endl;
cout<<c;
}
Execute this code, then you will know the reason behind returning false...