int main()
{
	char str1[N],str2[N];
	printf("Enter the first word:");
	gets(str1);
	printf("Enter the second word:");
	gets(str2);
	if(are_anagrams(str1,str2))
		printf("They are anagrams.\n");
	else 
		printf("They are not anagrams.\n");
	return 0;
}
int main(void) {
	char str1[MAX_SIZE], str2[MAX_SIZE];
	printf("Inserisci la prima stringa: \n");
	getstr(str1, MAX_SIZE);
	printf("\nInserisci la seconda stringa: \n");
	getstr(str2, MAX_SIZE);
	
	if(are_anagrams(str1, str2)) {
		printf("\nLe due stringhe sono anagrammi!\n");
	} else {
		printf("\nLe due stringhe non sono anagrammi!\n");
	}
	
	return 0;
}
int main(void)
{
  char word1[NUM_CHARS], word2[NUM_CHARS];

  printf("Enter first word: ");
  read_line(word1, NUM_CHARS);
  printf("Enter second word: ");
  read_line(word2, NUM_CHARS);

  if (are_anagrams(word1, word2))
    printf("The words are anagrams.\n");
  else
    printf("The words are not anagrams.\n");

  return 0;
}
示例#4
0
int main(void){
    char *word1, *word2;
    word1 = malloc(1<<9); //used this for safey, though I wasn't having problems with this string
    word2 = malloc(1<<9); //word2 was being initalized as a null pointer. Using malloc fixes that

    printf("Enter first word: ");
    fgets(word1, MAX, stdin);
    printf("Enter second word: ");
    fgets(word2, MAX, stdin); //Would get segfault here if malloc wasn't used
    if(are_anagrams(word1,word2)){
        puts("The words are anagrams.");
    } else {
        puts("The words aren't anagrams");
    }

    return 0;
}
int main(void)
{
    char word1[WORD_LEN + 1], word2[WORD_LEN + 1];

    printf("Enter first word: ");
    read_word(word1, WORD_LEN);

    printf("Enter second word: ");
    read_word(word2, WORD_LEN);

    printf("The words are ");
    if (!are_anagrams(word1, word2)) {
        printf("not ");
    }
    printf("anagrams.\n");

    return 0;
}
示例#6
0
文件: ch13pp14.c 项目: j-angus/cpama
int main(void)
{	PRINT_FILE_INFO
	char word1[MAX_WORD_LEN+1]; /* user input */
	char word2[MAX_WORD_LEN+1]; /* user input */
	bool is_anagram;

	printf("Enter first word: ");
	read_line(word1, sizeof(word1));

	printf("Enter second word: ");
	read_line(word2, sizeof(word2));

	is_anagram = are_anagrams(word1, word2);

	/* test array to see if words contained same letters */
	/* all zeros means words were equal */
	printf("The words are %s anagrams.\n", is_anagram ? "\b" : "not");

	return 0;
}
示例#7
0
int main(void)
{
	int original_array[26] = {0};
	char input;
	char word1[100];
	char word2[100];
	printf("Enter first word: ");
	scanf("%s", word1);
	printf("Enter second word: ");
	scanf("%s", word2);

	if (are_anagrams(word1, word2)){
		printf("The words are anagrams.\n");
	}
	else{
		printf("The words are not anagrams.\n");
	}

	return 0;
}
示例#8
0
文件: anagram.c 项目: wgimson/Anagram
/* main function */
int main(void)
{
    char word1[MAX_LEN], word2[MAX_LEN];
    char *p = word1, *q = word2;
    bool is_anagram;
    int i;

    for (;;) {
        printf("\nEnter first word (press enter to quit): ");
        scanf("%s", p);
        
        if (strcmp(word1, "q") == 0) {
            printf("\nNow exiting anagram program; goodbye.\n\n");
            exit(EXIT_SUCCESS);
        }

        printf("\nEnter second word (press enter to quit): ");
        scanf("%s", q); 
        
        if (strcmp(word2, "q") == 0) {
            printf("\nNow exiting anagram program; goodbye.\n\n");
            exit(EXIT_SUCCESS);
        }

        is_anagram = are_anagrams(p, q);
        if (is_anagram)
            printf("\nThe words are anagrams.\n");
        else 
            printf("\nThe words are not anagrams.\n");

        for (i = 0; i < NUM_LETTERS; i++) 
            letters[i] = 0;
    }
               
    return 0;
}