I have an assignment that requires me to make a code to basically have the user input 5 letters into an array. The five letters then have to be checked against themselves for duplicates and they have to be letters. I am the worst at doing this, i will say that now. The book i have is about pointless, and i can't seem to find much information regarding C, most of what i find is C++ and what not. I am not sure how i need to approach this assignment. I was thinking i need to do an array or 5 elements (obviously) but how would i be best to compare them. would a bunch of singular entries be best? if i do that, and i add the ch to the array, then i would need some if statement to say "if a = b then blah, else (how do i add this to the array?)" and to throw the wrench, if they do equal, how do i tell the user to try again?
i have the following code written to check the user input to make sure they are actual letters
#include "stdafx.h"
int main(void)
{
char ch ;
printf("Please enter a character.\n");
scanf("%c",&ch);
getchar();
if (
96 < ch && ch < 123 ||
64 < ch && ch < 91
)
printf ("This is a valid character.\n");
else
printf("This is not a valid character, please try again.\n");
return 0;
}
past this point, i have spent a month on it an i am finally saying help!!!