cin >> a; //let suppose i enterd 50
i = a; //Here you are storing storing value of a in i so both will be 50
d = a-i; //than you did a-i that means 50-50 because you stored 50 in both a and i
cout << i << endl; //than you printed the value of i which was 50
cout << d << endl; //here you printed d which is a-i means 50-50 which is equal to zero
There is no problem in the program.
Well you can write the program in a better way so that you can understand what you have written.
double a, d;
cout<<"Enter Number ";
cin >> a;
i = a;
d = a-i;
cout <<"You Enterd " << i << endl;
cout <<"So " << i <<" - "<< i <<" = "<< d << endl;
well this program is easy to understand.