deraj8 0 Newbie Poster

I have looked everywhere but i have not been able to find any thing about comparing two strings alphabetically. I tried comparing the characters of each string but i do not know what comparing characters actually does. i am assuming it just compares the ascii codes of each character?

//this function should return (string1 < string2)
bool isLessThan (string string1, string string2) const
{
	if(string1== string2)
		return false;
        
        int i = 0;

	while((string1[i] != NULL)||(string2[i]!= NULL))
	{
		if(string1[i] < string2[i])
		{
			return true;
		}
		else if(string1[i] < string2[i])
		{
		return true;
		}
		else
			i++;
	}
	return false;
}