In C++ float value being truncated from double
I've coded using float variables before and never had this problem. float a, b, subtotal, stx; a=15.95; b=24.95; subtotal=a+b; stx=subtotal*.07; cout << "Item 1: $" << a << endl; cout << "Item 2: $" << b << endl; cout << "\nSubtotal: $" <<subtotal<< endl; cout << "Sales Tax: $" << stx << endl; cout << "Total: $" << subtotal+stx << endl; relatively strait forward code warning C4305: '=' : truncation from 'double' to 'float' I understand the idea of data being truncated (and I also know that you can write the f at the end of the variable. But if variables are declared as float why is the