Question: What happens when you execute this? Why does this happen? Please explain. #include using namespace std; int main(){ double dbl = .35; cout < <

What happens when you execute this? Why does this happen? Please explain.

#include using namespace std; int main(){ double dbl = .35; cout << "dbl is .35" << endl; for(int i = 0; i < 10; i++) dbl += .15; cout << "Just added 1.5 to dbl" << endl; cout << (dbl == 1.85) << endl; cout << "Hmmm, how is this possible? Let's adjust precision and display again:" << endl; std::cout.precision(20); cout << dbl; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!