Hi all. I am trying to create a function to check if a string is a pangram or not. I think I have good start on it, but I can't figure out how to check if the characters in the string are unique. I have to do this recursively with no global or static variables. I created a counter variable the gets incremented every time the isPangram function gets called. I figure since there are 26 letters in the alphabet, if I can figure out how to insert 26 unique characters into a new string from the old string that would make it a pangram. Here is my code so far. Any pointers would be grateful.
#include <iostream>
#include <string>
using namespace std;
bool isPangram(string str, int counter, int last_index)
{
if(counter >= 26)
{
return true;
}
else
{
return isPangram(str, ++counter, --last_index);
//return false;
}
}
bool isPangram(string str)
{
return isPangram(str, 0, str.length() - 1);
}