How to add source code to wordpress post?

There are many ways to do this but the one I like it a plugin called SyntaxHighlighter Evolved

The output is like this

  /*  Is the game over? */
  bool IsGameOver(void) const;
  /*  Get the number of blocks remaining */
  int GetRemainingCount(void) const { return m_nRemaining; }
  /*  Function to delete all adjacent blocks */
  int DeleteBlocks(int row, int col);