title: Ask user to enter his/her name, and then reverse the given name and show it on screen. using character array
body: <p>My code is this But i am getting garbage values. how do i make it general so that anyone can use it?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  void main()
  {
  char ch[31];
  cin.get(ch,31);
  for (int i = 30; i &gt;= 0; i--)
      {
        cout &lt;&lt; ch[i];
      }
  system("pause");
  }
  </code></pre>