I spent my bored time during the lack of power learning C, and finally got to the point of understanding where I was ready to take on a puzzle presented by
etybolik and
blueminder over a year ago. See my Perl entry for etails, or if you're lazy, the point was to make a program where you would input two words, and it would use the second for comparison against the first word, such that for each letter, if it existed in the first word in the same place it would become a "#", if it existed in the first word but in a different place it would become a "*", and if it wasn't in the first word at all it would become a ".". Anyways, I spent about 10 minutes on it, and here is my code, shorter and cleaner than both Enrique's and Tony's.
#include
#define MAXLEN 100
main()
{
int i,j;
char first[MAXLEN],second[MAXLEN],result[MAXLEN];
printf("Enter the first word: ");
scanf("%s",first);
printf("Enter the second word: ");
scanf("%s",second);
for (i = 0;second[i] > 0;i++)
if (second[i] == first[i])
result[i] = '#';
else {
for (j = 0;first[j] > 0;j++)
if (first[j] == second[i])
result[i] = '*';
if (result[i] != '*')
result[i] = '.';
}
result[i] = '\0';
printf("Result: %s\n",result);
}