title: Can someone please check my timer program in C++
body: <p>I want to write a program that checks if the changes in the values of X,Y and Z don't exceed a difference of 10 within 5 seconds, the initialValues() function should be called.</p>
  
  <p>I have written the following program but it crashes while running and the program doesn't work. Then I have to force close the program.</p>
  
  <p>below is the main part of my program for timer. My program doesn't crash when I remove this specific part. </p>
  
  <p>How do I fix this?</p>
  
  <pre><code> while(X&lt;=X+10 || X&gt;=X-10 &amp;&amp; Y&lt;=Y+10 || Y&gt;=Y-10 &amp;&amp; Z&lt;=Z+10 || Z&gt;=Z-10)
     {
         clock_t t;
         t = clock();
         t = clock()-t;
         float timer = t/CLOCKS_PER_SEC;
         if(timer==5)
         {
             initialValues(X,Y,Z);
             cout&lt;&lt;"X = "&lt;&lt;initialX&lt;&lt;" Y = "&lt;&lt;initialY&lt;&lt;" Z = "&lt;&lt;initialZ&lt;&lt;endl;
         }
     }
  </code></pre>