I am trying to create a function that takes a string as an input and compares each character to each other to ensure they don't repeat.
The string consists of 26 alpha characters
The goal is to compare the 26 characters to each other to ensure that none repeat.
To do that, I want to use strcmp
(because I know not of any function that compares chars).
To do that, I first need to convert the chars in my code to strings in order to compare them. How can I go about doing that?
This is my function:
bool is_valid_key(string verify)
int a = 0;
int b = 0;
string s1 = verify[a], s2 = verify[b];
for ( a = 0; a < verify[a]; a++)
{
if (strcmp( s1, s2) == 0)
return 0;
}
return 1;