title: if/else statement doesn't work c++
body: <p>I'm new to programming and this is my code.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int main(int argc, char** argv) {
  char name[50];
  cout &lt;&lt; "Please enter your name : " &lt;&lt; endl;
  cin &gt;&gt; name;
  
  if (name[0] = 'M')
  {
      cout &lt;&lt; "Your initial name is M" &lt;&lt; endl;
  }
  else
  {
      cout &lt;&lt; "Your initial name is not M" &lt;&lt; endl;
  }
  
  system("pause");
  return 0;
  }
  </code></pre>
  
  <p>When I run my code, I typed "Mark" in the window and the program said "Your initial name is M".That works fine <img src="https://i.stack.imgur.com/nxO8q.png" alt="image 1"><br>
  but when I type "John" in the window, the program still said "Your initial name is M" instead of "Your initial name is not M" <img src="https://i.stack.imgur.com/0XyHn.png" alt="image 2"><br>
  and I am wondering why.Are there something missing in my code? Thanks for your time.</p>