Hi,
I am trying to do a pretty basic project for my computer science class. The part that is giving me trouble is where the user needs to input every letter of the alphabet in a random order but only each letter can be inputted once. I was wondering if someone could take a loop at my two loops that I thought would solve this problem. Any help is appreciated...
Thanks
void enter_key()
{
char key[25];
int k,j;
cout << "Please input a key to be used. Make sure to enter every letter in the alphabet only once." << endl;
for (k=0;k<=25;k++)
{
cin >> key[k];
for (j=0;j<=25;j++)
{
if (key[k] == key[j])
{
cout << "Try a different letter: ";
cin >> key[k];
}
}
}
for (k=0;k<=25;k++)
{
cout << key[k] << " ";
}
return;
}