标签:
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<iostream>
using namespace std;
char find(char * str)
{
if(str==NULL)
return ‘\0‘;
int hash[256];
for(int i=0;i<256;i++)
hash[i]=0;
char *hashKey=str;
while(*hashKey!=‘\0‘)
hash[*(hashKey++)]++;
hashKey=str;
while(*hashKey!=‘\0‘)
{
if(hash[*hashKey]==1)
return *hashKey;
hashKey++;
}
}
int main()
{
char* a="afefcdd";
char res=find(a);
cout<<res;
system("pause");
}
标签:
原文地址:http://www.cnblogs.com/kangye/p/4820345.html