title: Always have 0 value from sqrt() in VC++
body: <p>I have some problem with the fonction sqrt()! I'm quite a beginner so be indulgent please, the answer might be really simple. So here's my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  using namespace std;
  
  int main()
  {
      int touche;
      int i;
      float x;
      float racx;
      const int NFOIS = 5;
      cout &lt;&lt; "Bonjours!" &lt;&lt; endl;
      cout &lt;&lt; "Je vais vous calculer " &lt;&lt; NFOIS &lt;&lt; " racines carrees" &lt;&lt; endl;
      for (i = 0; i &lt; NFOIS; i++)
      {
          cout &lt;&lt; "Donner un nombre: " ;
          cin &gt;&gt; x;
          if (x = 0.0)
          {
              cout &lt;&lt; "Le nombre" &lt;&lt; x &lt;&lt; "ne possede pas de racines carrees!" &lt;&lt; endl    ;
          }
          else
          {
              racx = sqrt(x);
              cout &lt;&lt; "Le nombre " &lt;&lt; x &lt;&lt; " a une racine carree de : " &lt;&lt; racx &lt;&lt; endl;    
          }
      }
      cout &lt;&lt; "Programme termine veuillez entrer un charactere pour fermer le programme." &lt;&lt; endl;
      cin &gt;&gt; touche;
      return 0;
  }
  </code></pre>
  
  <p>My problem is when i enter a number (it is stored, i checked it with a cout before posting it here "just in case it was it") is when the sqrt(x); it only tell the program that x and racx is 0 no matter what i type. I'm really clueless of what it can be. I also tried to change the #include  for "math.h" and still the same thing, so i think my code is wrong somewhere. </p>
  
  <p>I use Visual c++ 2013 if you wanted to know that in windows 7 ultimate 64-bits.</p>
  
  <p>PS: As you can notice my first language is french, but don't worry i understand english very well, even if i'm bad at writting :P.</p>
  
  <p>Anyway, thank you for the attention and help! It will be appreciated!</p>