title: count number of times a character appears in an array?
body: <p>i've been thinking for a long time and havent got anywhere with the program. i dont know where to begin. The assignment requires use of single function main and only iostream library to be used. 
  the task is to Declare a char array of 10 elements. Take input from user. Determine if array contains any values more than 1 times . do not show the characters that appears 1 time only.</p>
  
  <pre><code>Sample output:
  a 2
  b 4
  ..
  </code></pre>
  
  <p>a an b are characters. and 2 and 4 represents number of times they appear in the array B.</p>
  
  <p>i tried to use nested loop to compare a character with all the character in array and incrementing a counter each time similer character id sound but unexpected results are occuring.</p>
  
  <p>Here is the code</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  void main()
  {
  
      char ara[10];
      int counter=0;
      cout&lt;&lt;"Enter 10 characters in an array\n";
      for ( int a=0; a&lt;10; a++)
          cin&gt;&gt;ara[a];
  
      for(int i=0;  i&lt;10;  i++)
      {
         for(int j=i+1; j&lt;10;  j++)
       {
           if(ara[i] == ara[j])
                 {
                    counter++;
                    cout&lt;&lt;ara[i]&lt;&lt;"\t"&lt;&lt;counter&lt;&lt;endl;
                 }
       }
      }
  }
  </code></pre>