Q:

Why this program is printing "Yes" as output? 

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;
}

A:

0.7 has no exact representation as float.  The approximate float is a bit less than the double representation of 0.7 (which is the default interpretation when use as a constant in the if statement) . 
For more details on that, see the question linked for duplicate or the countless variations in the comments.