0 like 0 dislike
12.6k views

Write a function that tests whether two words or phrases are anagrams (permutations of the same letters):

寫一個判斷兩個單詞或詞組是不是符合易位構詞的函數。

#include <stdio.h>
#include <string.h>
#include <ctype.h>
int is_anagrams(char A[],char B[])
{
   /*INSERT YOUR CODE HERE*/


   /*END OF YOUR CODE*/
   //The function should return 1 if two words or phrases are anagrams, 0 if two words or phrases are not anagrams.
}

int main(void)
{
   char A[100],B[100];
   /*INSERT YOUR CODE HERE*/


   /*END OF YOUR CODE*/
   if (is_anagrams(A,B)) printf("Two words or phrases are anagrams");
   else printf("Two words or phrases are not anagrams");

   return 0;
}

Example input:

smartest
mattress

Example output:

Two words or phrases are anagrams

Example input:

dumbest
stumble

Example output:

Two words or phrases are not anagrams

Remember: You may correct the cases, but your code always be revised! 

[Exercise] Coding (C) - asked in Chapter 9: Functions
ID: 39986 - Available when: Unlimited - Due to: Unlimited
| 12.6k views
0 0
STRUPES!

79 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int is_anagrams(char A[],char B[])
{
* * ** * * * * * **** i,j,l,sum=0;
* **** * ** * * * * **** * * *
* ** * *** *** *** ** ** ***** *
* * ** * * **** ****** * * * * * * * * * *** * * *
******** * * ** * * * * ** * * ****** ** * ** * *** ** ** * *** * * ***** * **
* ** *** ** * ** *** ***** * * * * * ** * ** * ** **** ** * ** *** ** * ** *** *
******* * * ** * * * * *** *** * ** ** ** ** * * *** * * * * ** ** ** * * ** * *
*** * **** * **** * * ** * * **** **** ** *** * *** * *
**** *** * ** * * **** *** * * *** *** **
* *** *** * * ***** * **
** ** * * *** ** ****
** *** ** ****** ** ** ** * * * * * * * * * * ** 1;
* * ** ***** * * * *
* * **** * * ** ** * ** ** * ** ** ** **** * 0;
}

int main(void)
{
* * **** ***** * * * * ** A[100]={},B[100]={};
*** ** * * ** * * * ** *** * *
* * * * * * ***** *** *** ***
*** *** **** * ** **** (is_anagrams(A,B)) printf("Two words or phrases are anagrams");
** ** * *** * ** * * printf("Two words or phrases are not anagrams");

* ***** * * * **** * 0;
}
answered by (54 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int is_anagrams(char A[],char B[])
{
***** **** *** * * YOUR CODE HERE*/
* **** * * * ** * a[26],b[26],i,j=0,countA,countB,z=0;
* *** * ******* * * ***** ** *** {
*** ** * **** * * ** ** ***** ** * * * *** * * **
* ***** ***** ** **** * ****** **** * * * *
** ** * ** ** *** * ** * ***

* ******* ** ** * * ** ** *
*** ***** ** * ** * ** *** **

**** * * * * ** ** * ** * ** ** ** ** {
* * *** ***** ** ** * ** ** * * * ** ** * * ** * * * ******* {
* **** * ** * * * * * * * ** * ***** ** * * * * * * ** ** ** ** ***** * ** || A[countA]==97+j) {
* **** *** ****** * **** * ** ** * ** *** * ** * ***** * *** * ** **** * ** * *****
* *** * ** * ***** ** * ** * * * **** *** * * ** * ** ** * *** *****
* * * * ** * * * ** ** ** * * *** * *
**** * ** * * * *

* *** * **** * * * **** * * *** * * * {
****** **** * * * * *** **** ** * **** * * * * *** * {
*** ** ** * * ** * *** *** *** * * ** *** ** * *** * * ***** ** ** ** ** * * || B[countB]==97+j) {
** ** * *** * ** ** ** * * **** * * *** ** ** * * ** ** **** * **** ** * **
* ***** ******* ** ** ** ** * ** *** ** * * ** *
***** ** * * **** ** * * **** *** * *
* * *** * * * ** *** *


* ** * *** * * * *** * * *** * {
** * **** * *** * * * *** ******* * **** {
* * ** ** * * * *** *** * * ******* * * ** * ** * ** * **** **
** * ** * * * ** * **** **** ** ** * * **** *
* * **** * **** ** ***

*** * *** ** ** ** ** **** *** {
** *** *** ** ** * * *** * * * ** 1;
***** * ** * * ** **
* *** *** * ** * *** {
* ** * ** * *** ***** *********** ** ** ** * 0;
** * * * *** * ** *

   /*END OF YOUR CODE*/
** * ** * ** ** * * function should return 1 if two words or phrases are anagrams, 0 if two words or phrases are not anagrams.
}

int main(void)
{
   char A[100],B[100];
* **** * * * * YOUR CODE HERE*/
* ** * *** *** **** k;
** * * ** ** * **** ** **** ** * ***** {
* ** * * * ** *** * * * ****** * * ** * * * ** * *
* * * **** ** *** **** * * ** *** ** * * * **** *
** ** ** ** ** *

****** ** ** * * ** * ***** *****
* ******* ****** ** *** ** **
* ** * * ** ***** * OF YOUR CODE*/
   if (is_anagrams(A,B)) printf("Two words or phrases are anagrams");
   else printf("Two words or phrases are not anagrams");

** ** * * * * * * ** * 0;
}
answered by (-120 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int is_anagrams(char A[],char B[])
{
* * * ***** *** * ** *** i,j,l,sum=0;
** * ** ** * * *** * ****
* * ** * ** * * ** *** ***
* *** * * * *** ***** ***** ** * * * **** ******** * ** *
*** * * *** * ** * ** **** * * ** * **** * * *** *** *** * * * * ** ** **** ***
** *** * *** * ** * * * ** *** * ** * * * * * * * * * **** * ** * ** * * ** *
* * ** * ** * * *** ** * * *** ** * ** * ** ****** * ** * * * *** * ** ** * ***
* * **** ** ***** * ** ****** ** **** ** ** ** * *** *** *
** *** ** *** * ** **** * * * ** ** ***** ** *
* ** * * *** ** ** *** * **
*** * ** **** * **** ** * l;
*** * *** **** ******* * **
* * * * **** **** ** * ** **** ******** 1;
* ** * * * ** *
* ** * ** * ** * *** ** ****** * * * * * * * ** * 0;
}

int main(void)
{
* * ** * ** * ******** * A[100]={},B[100]={};
** ** *** ** * ** ** ** ** *
* * ** *** ** * *** *** ** *
* * ** *** ****** * ** ****** **** * * * * * *
* *** *** * * * * * (is_anagrams(A,B)) printf("Two words or phrases are anagrams");
** * * * **** * ***** printf("Two words or phrases are not anagrams");

* ** * * *** ** * ** 0;
}
answered by (54 points)
edited by
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 0
prog.c: In function 'main':
prog.c:27:12: warning: passing argument 1 of 'printf' makes pointer from integer without a cast [-Wint-conversion]
     printf(is_anagrams(A,B));
            ^~~~~~~~~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:364:12: note: expected 'const char * restrict' but argument is of type 'int'
 extern int printf (const char *__restrict __format, ...);
            ^~~~~~
prog.c:27:5: warning: format not a string literal and no format arguments [-Wformat-security]
     printf(is_anagrams(A,B));
     ^~~~~~
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int is_anagrams(char A[],char B[])
{
* ** * **** * *** i,j,l,sum=0;
*** * ** **** ***** * * ** *
* ** ** **** *** * * **** * ** ** * *
* *** * * *** * **** ** ** * * * *** *** * * ** *
* ** **** ** * ** *** ***** * * * **** * ***** * * * ** ** ** ***** *** ***
**** *** * * ******** ** ** * * *** * ** * * ** * * * * * * * * * * *** ** ** * *
*** * * * * * * ** * *** ** **** ** ** ** **** * * ** ******* *** * ** * *** * * * ** *** **
** * ** * *** * ** * ** ***** ** * * ** * * *** *** ** *** * * ** *
* * ** * ****** *** * **** ** * ** ***
* ** * ** * * * * * *
* ** *** ***** * * * *
*** * * * * ** *** ** *** ** * * * * 1;
** ***** *** * ** *** *
* * *** *** ** * ** * * *** * ** * ** * ** * * **** 0;
}

int main(void)
{
* ******* ***** * * ** A[100]={},B[100]={};
**** ****** ** ** *** * * **
*** ** ** * * ** ** * * * * *** *
** * * * ***** * ** (is_anagrams(A,B)) printf("Two words or phrases are anagrams");
********* * * ** ***** ** ** printf("Two words or phrases are not anagrams");

** * * *** ** * ***** ** *** 0;
}
answered by (54 points)
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include * *** * * **
#include * * **
#include * **** *


int is_anagrams(char A[],char B[])
{
* ** * * **** **** * YOUR CODE HERE*/
** * *** ** *** ** * * * a[26],b[26];
* * ** *********** i=0;i<26;i++) a[i]=0;
**** ** * **** * i=0;i<26;i++) b[i]=0;

* ***** * ******* ****** * *** *** *** ** *
* * *** ** *** * **** *** **** * ** ** ** ** *** * * * ** * * * *
*** **** * * * * * ** * * ** * * * * *** * ** * * * * ******* ** * * * * *
*** **** * * ** ** * * **** *** * ** ** ** ***
***** ** *** *** ******* * * ** * *** * * * * ***** * * * *** ** *
** ** *** * ** *** ** *** * * * ** ** ***** * * * ** * * ***** ***
** **** * ** * * ** ************** **** * *
** * ** * * ** *

** * * * * * * **** ** * ** **
* * *** ** *** * * * ** * * **** ** * ***** ** * ****** * *** * * ***** B[i]>='a'){
** *** * ****** ** * * * **** * ** **** ***** * ** * ***** ** * ** ** *
* * * **** * * ** ** * ** * * ** * * ** *
* *** * ** ** * *** * * * * ******* * * * ** * * ** ** * ** **** *** *
* * * * * * ** *** *** * * * * ** * ** ** * *** ** ** ****
** * * * * * *** * ***** * * *** * **
* * ** ** * *** ** ***

** ** ***** *** * * * * * flag=1;
*** **** * * * *** ** * ** i=0;i<26;i++){
* * * *** * ** * * * * ** ** ** * * * *** * * flag=0;
* * ** * * ***** *

* ** * * * *** ** * * *** ** return 1;
* *** * * * * ***** * return 0;
*** ** * *** *** OF YOUR CODE*/
** * **** **** ** * **** function should return 1 if two words or phrases are anagrams, 0 if two words or phrases are not anagrams.
}

int main(void)
{
** * ***** * *** ** A[100],B[100];
* ***** * ** * * * YOUR CODE HERE*/
**** ** **** *** **** * * * * * *
** **** * * * **** *** * *** ** * **
* ** ** ** ** *** * OF YOUR CODE*/
*** ** *** * *** (is_anagrams(A,B)) printf("Two words or phrases are anagrams");
* * ** *** printf("Two words or phrases are not anagrams");

** * * ** * * ** 0;
}
answered by (-116 points)
0 0
prog.c: In function 'main':
prog.c:46:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(A);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:47:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(B);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccia1fZt.o: In function `main':
prog.c:(.text+0x376): warning: the `gets' function is dangerous and should not be used.
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include * ** * * **
* * * * * **** ** * *
** *** * * *** ** **

int *** * ** A[],char B[]);
char * * * *str);

char **** *str)
{
* * * **** * * * ***** * ** ** ** * *p1, *p2;

************ * * * *** *** *** (! str || ! *str)
***** * *** * * * *** * * * * * * * ** * ** * * * * * *** *** str;
** ****** ** * ** *** ** ** (p1 = str, p2 = str + * * ** - 1; p2 > p1; ++p1, --p2)
** **** ** * ** ** * * * ****
* * ** *** * * * * *** *** **** *** * * ***** ** **** * ***** *** ^= *p2;
* * * * * * ** *** * * *** * **** ** *** ** ***** ** ** *** ^= *p1;
* *** ** ** * ** * ** ** * * ** ** ** ** ** ** * **** * **** ***** **** ^= *p2;
*** * * * *** *** *** * * *
* * *** * ** ** ** * ** ** **** **** * str;
}

int **** ** ** B[])
{
* ** ** * *** ** YOUR CODE HERE*/
* *** * * *** ** ** * * *
** * * * * * ****** **** flag=1;
** *** ** ** ***** * * * ****** ***** *
* ***** *** ***** ** **** * * * ** ** ** * ***** * flag=0;
* ** ** * * * *
* * ** * * * ******* * *** * * return 1;
**** * * * * * * * * return 0;
**** * * *** ** OF YOUR CODE*/
* ** ** * * **** function should return 1 if two words or phrases are 0 if two words or phrases are not ** *
}

int * *
{
* * ** * * * ** * * * * *
* * ** **** * * * * ** YOUR CODE HERE*/
* * *** ** * ****** ** * * ******** ***
*** ** * * * * * ******** *
* *** * ** *** *** OF YOUR CODE*/
* * * * * * **** * ** ** ** * words or phrases are * *** **
* ** * ** * ** * * ** ** words or phrases are not ** * * *

***** * ** ** ** 0;
}
answered by (-116 points)
0 0
prog.c: In function 'is_anagrams':
prog.c:25:25: warning: 'sizeof' on array function parameter 'A' will return size of 'char *' [-Wsizeof-array-argument]
     for(int i=0;i<sizeof(A);i++){
                         ^
prog.c:20:22: note: declared here
 int is_anagrams(char A[],char B[])
                      ^
prog.c: In function 'main':
prog.c:38:17: error: 'STDIN' undeclared (first use in this function)
     fgets(A,100,STDIN);
                 ^~~~~
prog.c:38:17: note: each undeclared identifier is reported only once for each function it appears in
0 0
prog.c: In function 'main':
prog.c:41:17: error: 'STDIN' undeclared (first use in this function)
     fgets(A,100,STDIN);
                 ^~~~~
prog.c:41:17: note: each undeclared identifier is reported only once for each function it appears in
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include * * * **
#include **** **
** * * ***** ** ** *

char * *str)
{
* * ** ** * * ** * * *** * * * *p1, *p2;

* * * *** * * *** *** * * ** (! str || ! *str)
* *** * * *** * ** * *** **** ** * * * **** * * ** ** str;
*** ** ** ** **** * ** **** * * * * (p1 = str, p2 = str + ** ** - 1; p2 > p1; ++p1, --p2)
** *** * * ***** ***** * ** *
** ** ** ** ** * * * * *** **** * * * * ** * * ***** ** *** ** * ^= *p2;
* * * ** *** **** ** * ***** ** * * ** * ** * * * **** * * * *** * *** ^= *p1;
** * * ** **** **** * ** * * * **** * * ** * * ******** ** ^= *p2;
**** * ** ** * * ** ** *****
* * ** **** *** ** **** * * * * ** *** str;
}

int * * ** ** ** A[],char B[])
{
* * ** * * ** ** ** * YOUR CODE HERE*/
**** ** *** * **** ** * *
* * ** * * ** ** ** ** flag=1;
* ** ** **** * ***** ** ** ** ** **
* * * * ** * * * ** **** * * * * ** * *** *** flag=0;
* * *** ****** ****
*** * * * *** ** return 1;
* * * * ******* **** ** ** ** return 0;
* * *** ***** ** * ***** OF YOUR CODE*/
* * * ** * ** ** function should return 1 if two words or phrases are ** 0 if two words or phrases are not anagrams.
}

int * *
{
* *** * ** * ** ***
** **** **** ** YOUR CODE HERE*/
* ****** * *** ** *
*** ** * * * * * ** *
*** **** ******* * * OF YOUR CODE*/
** * * * * ** * * *** * * * words or phrases are *** * ** **
**** * ** ** ***** ** * ******* words or phrases are not * * ** ***

* * *** * * ** 0;
}
answered by (-116 points)
edited by
0 0
prog.c: In function 'is_anagrams':
prog.c:8:5: warning: implicit declaration of function 'strrev' [-Wimplicit-function-declaration]
     strrev(B);
     ^~~~~~
prog.c:10:25: warning: 'sizeof' on array function parameter 'A' will return size of 'char *' [-Wsizeof-array-argument]
     for(int i=0;i<sizeof(A);i++){
                         ^
prog.c:5:22: note: declared here
 int is_anagrams(char A[],char B[])
                      ^
prog.c: In function 'main':
prog.c:23:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[100]' [-Wformat=]
     scanf("%s",&A);
             ^
prog.c:24:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[100]' [-Wformat=]
     scanf("%s",&B);
             ^
/tmp/cccQBKVr.o: In function `is_anagrams':
prog.c:(.text+0x1d): undefined reference to `strrev'
collect2: error: ld returned 1 exit status
0 0
prog.c: In function 'is_anagrams':
prog.c:8:5: warning: implicit declaration of function 'strrev' [-Wimplicit-function-declaration]
     strrev(B);
     ^~~~~~
prog.c:10:25: warning: 'sizeof' on array function parameter 'A' will return size of 'char *' [-Wsizeof-array-argument]
     for(int i=0;i<sizeof(A);i++){
                         ^
prog.c:5:22: note: declared here
 int is_anagrams(char A[],char B[])
                      ^
prog.c: In function 'main':
prog.c:23:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(A);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:24:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(B);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccPKFx24.o: In function `main':
prog.c:(.text+0xa1): warning: the `gets' function is dangerous and should not be used.
/tmp/ccPKFx24.o: In function `is_anagrams':
prog.c:(.text+0x1d): undefined reference to `strrev'
collect2: error: ld returned 1 exit status
0 0
prog.c: In function 'is_anagrams':
prog.c:25:25: warning: 'sizeof' on array function parameter 'A' will return size of 'char *' [-Wsizeof-array-argument]
     for(int i=0;i<sizeof(A);i++){
                         ^
prog.c:20:22: note: declared here
 int is_anagrams(char A[],char B[])
                      ^
prog.c: In function 'main':
prog.c:38:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(A);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:39:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(B);
     ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccVNJSV3.o: In function `main':
prog.c:(.text+0x141): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
* ** ** * *** ** *
* *** ** *****
** ** * ** ********


int ** ** ** * ** B[])
{
** * ** * * * * * YOUR CODE HERE*/
int n1[26] = {0}, n2[26] = {0}, i=0 ;
int *** **

* * * ** * ** ** * * * * * **
* ** ** * * * ** ****
*** *** ** * ** ** ** * *** *** *** * *** * ** **
* **** * * **** **** ** *** ** * *** * * *** ** - 'a']++;

* ** * * *** * * *
* * * * * *

* ***** * ****** ****
**** * ** * ** * * * * ***** ********** * **
* * * **** * ** * * * * * ** * ** * -'a']++;


** * * * * * *** * * *
* * * ***** * * **** **** (i = 0; i ** 26; i++)
***** *** *** *** * * ***
* ****** *** * * * * ** * * *** (n1[i] != n2[i])
***** ** * *** *** * **** * * * * *** * ***** ***** ** * ** * 0;
*** *** *** ** ** * *
***** *** ** ** * * ** * 1;

** * **** ** ****** ** * OF YOUR CODE*/
** * ** *** ** *** * * should return 1 if two words or phrases are * *** 0 if two words or phrases are not * **
}

int ** * *
{
* *** ****** *** * ** *** *
** ** *** *** YOUR CODE HERE*/

** * * * ** * * **** 100, stdin);
* * 100, stdin);

* * *** ** OF YOUR CODE*/
******* ****** * * **** *** * * * * * ** * words or phrases are * *** * *
** * *** * * * * * * *** *** * words or phrases are not ** * **

* *** ***** 0;
}
answered by (-304 points)
edited by
0 0
prog.c: In function 'main':
prog.c:37:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'char (*)[100]' [-Wformat=]
     scanf("%s%s",&A, &B);
             ^
prog.c:37:15: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'char (*)[100]' [-Wformat=]
     scanf("%s%s",&A, &B);
               ^
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 0
what are case 2 and case 3? ) cant find anything wrong in code
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 like 0 dislike
Hidden content!
#include *** * ** *
#include ** *** *** * *
#include ***** ** ** * **
int ** ** **** A[],char B[])
{
* ***** ** * * **** a[26]={0}, b[26]={0}, i;
* * * ** ** *** ** n = strlen(A);

** *** * * *** *** = 0; i < n; i++)
** **** * *** * ** ***
******* * * * ** *** ** * ** *** ** * = ***
*** ***** **** * * * * ** * ** * * * ***
* ** * ****

* ** *** * * *** * * = 0; i < n; i++)
** * *** ** ***
* *** ** ** **** **** ** ** * * ** ** **** = *****
* ** * ** * * **** *** *** * *** ** ***** *
** * ** * *

*** ** * ** = 0; i < 26; i++)
* ** *
*** * * * * ** * ** * ** * * * **** ** * * != b[i])
** ** ***** * * *** ** **** *** ***** * 0;
* * ** ** * * *
* * ** * *** *** * * * 1;
}

int main(void)
{
* **** ** ** *** * ** *

** * ** * ***** * ** 100, stdin);
* * ****** * * ** * 100, stdin);

* * ** *** * * * **** * * ****** *** words or phrases are ** *** *
* ** * * * ** * * * ** *** words or phrases are not * ** ***

* * * * *** * * ** 0;
}
answered by (5.2k points)
edited by
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 0
prog.c: In function 'main':
prog.c:37:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(A);
    ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
prog.c:38:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(B);
    ^~~~
In file included from prog.c:1:0:
/usr/include/stdio.h:640:14: note: declared here
 extern char *gets (char *__s) __wur __attribute_deprecated__;
              ^~~~
/tmp/ccvcqKyj.o: In function `main':
prog.c:(.text+0x1ff): warning: the `gets' function is dangerous and should not be used.
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
Case 4: Correct output
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
Case 4: Correct output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Case 4: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Case 4: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.188
©2016-2025

Related questions

0 like 0 dislike
47 answers
[Exercise] Coding (C) - asked Dec 7, 2017 in Chapter 9: Functions by semicolon (5.2k points)
ID: 35785 - Available when: 2017-12-07 18:00 - Due to: Unlimited
| 6.2k views
0 like 0 dislike
45 answers
[Exercise] Coding (C) - asked Dec 7, 2017 in Chapter 9: Functions by semicolon (5.2k points)
ID: 35784 - Available when: 2017-12-07 18:00 - Due to: Unlimited
| 6.6k views
0 like 0 dislike
41 answers
[Exercise] Coding (C) - asked Dec 14, 2017 in Chapter 9: Functions by semicolon (5.2k points)
ID: 37370 - Available when: 2017-12-14 18:00 - Due to: Unlimited
| 5.8k views
12,783 questions
183,442 answers
172,219 comments
4,824 users