Searching first non repeating character The program finds the first non repeating character in a character array, array contains only small case letters.  

#include&lt;iostream&gt;
#include&lt;cstring&gt;
using namespace std;
int main()
{
char a2z[26]={0};//Hash

char input[100] = "abcbbbcdegh";//sample input, only small case english alphabets
int n = strlen(input);

for(int i=0; i&lt;n; ++i)
{
    if( a2z[  input[i]-97 ]&lt;0 )
    {
         //do nothing, this character has already repeated
    }
    else if( a2z[  input[i]-97 ]==0 )
    {
        a2z[ input[i]-97 ] = i+1; //character encoutered first time
    }
    else
    {
        a2z[ input[i]-97 ] = -(i+1); //repeating character
    }
}

int minAt=n+1;
for(int i=0; i&lt;26; ++i) //finding first non-negative character in the Hash
{
    if( (a2z[i]&gt;0) &amp;&amp; (a2z[i]&lt;minAt) )
    {
        minAt=a2z[i];
    }
}

if( minAt == n+1 )
    cout&lt;&lt;"\n\n no unique character";
else
    cout&lt;&lt;"\n\nFirst unique character is "&lt;&lt;input[minAt-1]&lt;&lt;" at position "&lt;&lt;minAt-1&lt;&lt;endl; 
}  


output ::  

First unique character is a at position 0


here, i have taken an character array (i.e. a2z) of 26 characters initialized with zero, using it as Hash.
 if a2z[i] is zero means ith character (of English alphabet) has not encountered till now, postive value of a2z[i] denotes ith character has been encountered only once at position a2z[i]-1, and negative values shows it has repeated.
pls review this code.
This is a bad habbit stop doing it.

using namespace std;


Once your programs are more than 10 lines long it starts adding complexity including the whole namespace. SO best not to do it. Get into the habit of not using now otherwise breaking the habit is hard latter.

Don't put bad comments in you code (in fact try not to put comments). A comment should explain what you are trying to achieve (or potentially why) (NOT HOW). The code explains how so don't duplicate the code in comments. The worst thing to find in code is comments that don't match the code.

char a2z[26]={0};//Hash


This is not a hash. A hash has a very specific meaning and this is not what you are doing.

Prefer to use [] when declaring the array. This means the compiler will try and establish the length of the array for you.

char input[100] = "abcbbbcdegh";//sample input, only small case english alphabets


While we are here. Stop using C stuff in C++. Learn to use C++ constructs and don't mix the languages up. Another bad habbit you should fall into.

int n = strlen(input);


C++ has its own string class.

std::string  input("abcbbbddddd");
// size is input.size()


Learn how to use iterators.

for(int i=0; i&lt;n; ++i)


It will allow you to be more versatile with your code. Potentially allowing your code to work with multiple container types (not just string). But more importantly it is the first step to using the standard algorithms.

You are making the assumption that your input only contains lower case letters. You should always code defensively. You MUST validate your input.