I was just playing around with data types and landed on this dilemma. Can anyone here explain me the reason
#include<iostream>
using namespace std;
int main() {
float a= 0.7;
if(a < 0.7)
cout<<"Yes";
else
cout<<"No";
return 0;
}
I know it is because automatically 0.7 as a literal will be of double.
#include<iostream>
using namespace std;
int main(){
float a= 0.8;
if(a < 0.8)
cout<<"Yes";
else
cout<<"No";
return 0;
}