0

Why would this code not stop executing?? So when I execute this code, the value of x is 1.0 as a point but this won't stop executing. Please tell me why is this happening..!

#include <iostream>
#include <cmath>

using namespace std;


int main ()
{



  double x(0.0);
  double increment(0.1);

  //cout.setf(ios::fixed);
  while (x != 1.000000)
  {
    cout << x << endl;
    x += increment;

    if (x >= 1.1){
      break;
    }
  }

  return 0;


}
Yu Hao
  • 119,891
  • 44
  • 235
  • 294
Shashank Agarwal
  • 712
  • 8
  • 14

0 Answers0