3 like 0 dislike
3.7k views
Show more...
[Exercise] Coding (C) - asked in 2017-1 程式設計(一)AD by (18k points)
ID: 33758 - Available when: Unlimited - Due to: Unlimited
| 3.7k views

20 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
** ** * * ** * ** * * * a[1000]={'\0'},b[1000]={'\0'};
** * * ** * **** ** i,j,x,y;

* * * * * **** ******** * ** ** %s",a,b);

**** * ** * * ***** * * * ** * *****
******** ** **** * * **
*** * ** **** * * * ** * ***** * * ** * * * **
** * * *** * **
* *** * * * ****** *** *** * **
**** * ** * * * *
******* * * * *** * * ** * ***** * *** *** * * * * **
    }
    
*** * * ** * ** * * * * ** ********* %d",x,y);
    
* * ** ** * ** ** ** *** **
**** * * * ** ** ** * * * *** * *** *** * * * * ***
*** * * * * * ** * *** ** *
*** * * *** * * **** ****** * ** *** ** *** ** * * ** * * * ** *
*** * * ** ** ** ** *
* ** * ** * * ** **** ** ** * ** * * * ** ******** * ** **** *** * ******* ***




* *** * ** ** **** * 0;
}
answered by (236 points)
edited by
0 0
prog.c: In function 'main':
prog.c:11:12: warning: multi-character character constant [-Wmultichar]
         x+='a[i]';
            ^~~~~~
prog.c:15:12: warning: multi-character character constant [-Wmultichar]
         y+='b[j]';
            ^~~~~~
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
prog.c: In function 'main':
prog.c:11:12: warning: multi-character character constant [-Wmultichar]
         x+='a[i]';
            ^~~~~~
prog.c:15:12: warning: multi-character character constant [-Wmultichar]
         y+='b[j]';
            ^~~~~~
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
**** * * * * ** a[1000]={'\0'},b[1000]={'\0'};
* ** ****** ** *** i,j,x,y;

* *** * *** *** * ** * * * %s",a,b);

*** * ** * * ** *** ** * * ***
** **** ** * ******* ** ** **
** * *** * ** ** * * * *** *** * * **** *** *
* ** *****
* ** ** *** * ** ***** ** * * ** *
* ** *** * * * ***** **
***** ******* * ** ** ** * * *** *** **
* * *** ** **** ****
* * ** ** ** ** ** * *** * %s",a,b);
** * * * *** *** **** ****** * * %d",x,y);




* ** * ** ** ** **** ** 0;
}
answered by (236 points)
0 0
prog.c: In function 'main':
prog.c:7:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
     scanf("%s %s",a,b);
             ^
prog.c:7:16: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int *' [-Wformat=]
     scanf("%s %s",a,b);
                ^
prog.c:11:12: warning: multi-character character constant [-Wmultichar]
         x+='a[i]';
            ^~~~~~
prog.c:15:12: warning: multi-character character constant [-Wmultichar]
         y+='b[j]';
            ^~~~~~
prog.c:17:14: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
     printf("%s %s",a,b);
              ^
prog.c:17:17: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int *' [-Wformat=]
     printf("%s %s",a,b);
                 ^
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
* * * * * * **** * * a[1000]={'\0'},b[1000]={'\0'};
****** **** ** * * i,j,x,y;

***** * * * ** * * *** * *** * * %s",a,b);

* ** * * * ** * *** ** *
** * * ** ** * *****
** * *** ** **** * * * ** ********* ** * * ** ** *
* * * ** **** ** **
** * * * ** *** * ** **** ** ***
** *** * *** *** *
**** * * ** * * ***** * * ***** **** * **** ** **
* *** * ** ** * * ** ** * *
** ***** * * *** * *** * **** %s",a,b);
******* * ****** * ***** * **** %d",x,y);




** * ** * *** ** *** * *** * * 0;
}
answered by (236 points)
0 0
prog.c: In function 'main':
prog.c:7:13: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
     scanf("%s %s",a,b);
             ^
prog.c:7:16: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int *' [-Wformat=]
     scanf("%s %s",a,b);
                ^
prog.c:11:12: warning: multi-character character constant [-Wmultichar]
         x+='a[i]';
            ^~~~~~
prog.c:15:12: warning: multi-character character constant [-Wmultichar]
         y+='b[j]';
            ^~~~~~
prog.c:17:14: warning: format '%s' expects argument of type 'char *', but argument 2 has type 'int *' [-Wformat=]
     printf("%s %s",a,b);
              ^
prog.c:17:17: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'int *' [-Wformat=]
     printf("%s %s",a,b);
                 ^
0 like 0 dislike
Hidden content!
* * * * ** * * **

int main()
{
** **   char a,b;
* * *  
* ** * * * ** ** * * * ** * ** * *** ** **
** ** ****
  ***** * **** ***** * * * *
*** * ** ** ** * * * ** **
* * * ** * else * ** * ** ** ** ** * * *
* * * * **** *** * *** * ** * ****
* * * ** else ** * ** ** * ** * *
* * **** * * ** * * *** ***
* ** ** **
*** * * * ** return 0;
* **  
}
answered by (215 points)
edited by
0 0
prog.c:1:1: error: expected identifier or '(' before '.' token
 .
 ^
0 0
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
* * ** * ** ** *** *
* *** ** * **
int main()
{
* ***** ** * char * * *
* * * * ** ** ** * * * * ***
* * * * ** * {
* * * ** ** ** * * * int **
* ** * ** * *** ****** char * * ***
* * * * ** *** * **** * *** *
***** * *** * * * ** * **
** * * ***** ** * * *** ** ** * *
* * ** * *** *** * ** * **
****** * * **** * * **** **** ** ***** *
* ** ** *** * ** {
* * * * * * * * * * ***** ** * ********* *** ** ** * * *** * * ******** **
******* ** ** ** ** * * * * * * * * * * * * *** * a[i]+=32;
* * ** **** * **** * **** }
** * ** *** * * ** * ** ** *
**** ** * ** **** * * * * {
** * ** ** ** ** **** * * ** ** * * * * **** * * * ** ** ***
* ** * ** *** * ** * ** * * * * * b[i]+=32;
* ***** * ** ** **** * }
** *** ** * * * ** *
*** * ** ***** * * ** {
** * * * * * * * ** * * * **** * ** * ******
* *** ** * ** * ** * * * ** *** * ** * {
* * * ** * * * *** *** *** *** ** * ** ** *
*** * ** *** * *** ** * * * * *** ** * * * ** * * *** * {
** * ** * * *** * ** * * *** ** *** * * * ** * ** ** * * * flag=1;
* ** ** * * * ** * ** * * ** ** * *** ** ** * *** *** * *** * ** * * break;
*** * ** * ** * * * *** * * **** *** **** * * * ** ** *** }
* *** * *** ** * **** ** ** * * *** ** ** * ** else ** * ** ****
*** ** * ** ** ******* ** *** * ** * * * **** ** * * ** ** * ** {
* **** ****** * ***** * * * * * *** * * ** * ** ** *     flag=2;
***                       break;
** *****                   }
* ** *               else
* *                   flag=2;
*       ****** **
*       }
* ** **       **** ***
***** **   **   {
** ***** ** * * ** ***** * *** * * *
*** ** **** ** *** ** **** *** * **** {
* * * * *** * * *   ***** * ** * * **
* * * * ** **** *** *** *** * ** * *** * * ** * ** * {
** * * * *** ** ** * ** **** * *** * * * * *** *** ** * * * *** flag=1;
* * ** ** * * * * * * * *** * *** *       break;
*** **             **** ** * * * * ** * ** *** }
** *** * * * ** ** * ** * ** ** ** **** * else **** * * * *
**** ** * ** ** * * * ** ** ******* * *** * ** * ** *** **** {
* ** * ** ** * ** **** * ** * *** * **** * ** * * *** ** ** ** * flag=2;
** * * * ** ** ** * ** ** * **** * * * *** ** * * * break;
* ** *** * **** * * * ** ** *** * * ** *** **** * }
** ***** *** *** ** ** ** * * ** ** * * ** else
* ** * * * ** * * * ** ** ** * * * **** ***** * * flag=1;
* * *** ** **** **** * ** *** }
*** * * ** * }
* *** * ** * * * *** ** if(y==x)
* *** ** ** ** * * *** {
* * * * **** * * * * **** * * ** * ** *** **
* **** ** * * * ** **** * ** * * * ** * ** {
**** * * *** * ** ** ** * ** **** * * * * * ** * *
* * ** * * * * * ** * ** * *** ** ** * *** * {
* * ** **** ** * * * * **** * * * * * * ** **** ** flag=1;
* *** * ** ** * ** ** ** * *** **** *** ** ** * ***** * *** ** break;
** * ** * * *** ** * * * ** *** ***** ** * **** ** }
** * * ** * *** * * ** * *** ** * else ** * ** ***
******* **** * *** * *** * * ** **** * * ** **** * * ** * * {
* **** * *** * * * ** ** * * * * ** * * * ** ***** * * * * flag=2;
* * * *** * * * * * ** ** ** ** ****** * * * * * ***** * * * ** * * * * ** break;
*** * * ** * * * *** * * * ** ** ** ** * ** * **** *** * }
** * * * * * ** * * * ** * * * * ** else
*** * ** * **** * ** * ** * * * * * *** ** * * *** flag=3;
* * * *** ** * * * ** }
** ** *** * * * *** }
* * * ** * * * **** ** * ***
* * * *** * *** {
* * * ** * * ** * *** *** *** case 1:
**** *** ** ** ** * **** ** *** * ** * ** **** * * * * < ** *
* ** *** ** * * ******* * *** * ** * * ** ** break;
* ** * * *** * **** * **** * ** *** case 2:
* ** * * * * ** * * * * ** ***** * * * * > * ** ** *
* * ** * * **** * *** * ** * * ** *** ** * * break;
** ***** * * ** ****** ** case 3:
*** **** * *** * ** **** * * ** * *** *** ** * * * * *** * *** == * ** ** *
* ** *** * * *** * * **** * * * ** **** * ** ** break;
* ** *** ** ** ** ** * * ** * }
** * ** * }
* ** * return 0;
}
answered by (100 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
***** * * * ***** * *
** ** ** ** **
int main()
{
** * * *** * char * *
* * * * ** ** * * *** *** ** ********
** * ** * * *** {
* ****** ** **** int * *
** * * ** ** ** char * *** **
* * ** * * * **** * * ** * ***
* **** ** ** * * * * ** ***
* *** * *** ** ** * * * * **
** * ** ***** ** ** * ** * **
** * ******* **** ** ** * * ** * * **
** * ** ** *** * * ** {
**** **** * ****** * *** * **** * ** ** ** * * *** * **** *** * ** * **
**** ** * * ** * ***** *** ****** * ** * * * a[i]+=32;
*** * * *** *** * }
***** * ** * * ** * ** * * *
* ** *** * * ** ** ** * ** {
**** ** ** * * **** *** * * ** * * ** *** * ***** ** ** *
* * * * ***** ** ** * * * * ** ** * b[i]+=32;
* * *** ** ** * * * * ** }
** * ** **** ** * * * *
*** * * ** * * * * {
* *** *** ** ** *** ** * * ** ** *** * ** *** *
** ** * * * * *** * **** * {
* * *** ** * ** * ** **** *** * * * ** * * * *
***** * ** ** * **** ****** ** ** * * **** * * * ****** {
* * * * * * * * ** * * * * * * * * ** ** * * ** * * ****** flag=1;
** ** **** * ** * * *** * * * ** * ** ** * * * * * * *** ** * * break;
** ** ** ** * ***** **** * ** ***** * **** * * * * * }
* **** * * * * * * * * * * ** else *** ******
* * *** * ** *** * * * ** * * * ** *** ** {
* * * ** ** * ** ** *** * * * * * ** ** * ***     flag=2;
** *                       break;
* *                   }
*** ***               else
*** * *                   flag=2;
** *       ** *
*       }
      ** ****
* **   **   {
**** ** * * * * ** * * * * * * ******* *****
* * * *** ** * * * ****** **** ** * *** {
* ** ** ** * ** ** * *   * * * * **** * *** * ** *
* * * * ** * * ***** ** * * * ** ** *** ***** {
* * * * * ** * * * **** ** ** ** * * ** * * ** * ***** * *** flag=1;
* * * **** ** ** * * * * **** *** ***       break;
*** *             * * * ** *** }
* * * * * ** * * ** * ** ** * *** else * * ***** *
** ** * * * ** * ** ** ** ***** * * ** * * ** ** *** *** * * {
* ** *** * * * ** ** * ** * * ** * ** *** * * ***** * * ** * * * * ** flag=2;
** ** ** * *** * * ***** ** ** * * *** ** * ** * * ** * ** *** * break;
** * ** ** ***** * ** * * *** * ** ** * }
**** * * * * * * * * * * * ** ** * * * else
* ** * * ** ** * * ** * * * *** ** * **** * flag=1;
* **** * ** *** *** * * * * }
** *** **** ******* ** *** }
*** ** ** * *** if(y==x)
* ** * *** *** * * {
*** * *** * * * ** ** * * ** * * * * ** *
* * ** ** * ** ** * ** {
* * ** * ** * * * * * * * * * ** ***** *** * * * * * *
* ** **** * * **** *** ** * * * ** * * * * * * ** * {
*** ** * * * * ** *** * * ** * **** * * * * * ** * ** * ** * ** flag=1;
** * * * *** ** * * * * * ** * ** * ** * ** * * * * ** break;
* * *** * ** * * * * * * * *** *** ** ** * * * ** * }
** * * **** * ** * **** * *** ** * * ** ****** else * * ** ******
* ** ***** ** * * ****** ** * * * *** ** * ** * * ** ** * {
* * * * * * **** ** * * * * ** *** * * * * * ** ** * *** ** ** * * flag=2;
* *** **** ** **** * * * ** ** ** * * * ** ** ****** *** break;
* ** ** * * * **** * ****** ***** * *** ** ** }
** * * * ** ** * *** *** * * ** else
**** ***** *** * *** ** * * * * *** *** ** * **** * * *** * *** flag=3;
******** ** * **** *** * * * * * * ** }
** * * * * * * * * **** }
** * * **** * *
** * * ******* *** **** {
**** ** *** * * * *** * * case 1:
* * * * *** * *** * ** *** * *** * ** ** * * * * < * * ** ** ****
** *** * * ****** *** ** * * *** * * ** break;
* * * * ** ** * * * ** *** **** case 2:
* * * * * * * * * * *** * * **** ** > *** ** **
*** *** * * *** * * *** * * **** * * break;
* ** * *** * ** ** * * * * case 3:
* ** * * * * ** * * * *** ** * * * * *** * * ** * * ** *** * == ** *** * *
* * * ** * * * * ** ** break;
*** * *** * ** * * ** * }
* ** **** **** }
* ** * * return 0;
}
answered by (100 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 like 0 dislike
Hidden content!
#include ** **** ***
#include *** * **** * **
#include * **** *

int main(int argc, char const *argv[])
{
*** * * ** char ** **** ** ***
* *** * *** * int com,i,j;
*** *** ** * * * * ** * *
* ** ** ** {
* **** * * ** * ** * ** * * *
* * * * *     ** * * * **** ** * * **** **
* * * * ****   *** * ****** * * * *
* * *** *** * * ** * ** * ** ** * ***** * *** * * * ** * * **** * *
** * ** ** * * * ** ** * *** *****
** * * ** * * * * *** *
* *** *** **** * * * **** * **** * *** * * * ** > * ** );
* * ** *** * * ** ** else * *
** * * ** * * ** ** * * ** * * * ** < * * * ** );
** ** * ** ** * * else
** * ** * * * * * *** * ** * * * **** ** ** == * * * * ** );
* *** * ** ** * }


*** * * ** ** return 0;
}
answered by (114 points)
0 0
prog.c: In function 'main':
prog.c:14:10: error: assignment to expression with array type
     tempb=tolower(b[i]);
          ^
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include * * ** * *
#include ** *** * * **

int ** *** char str[], const char key[]);

int main()
{
* ** * ** ** * *** * * str[1000], key[1000];
** ** ** * * ** * * *
** * * * * ** * * *
** * *** * *** ** ** * *** ** * * %d *** count(str, key));
*** ** * * ** * 0;
}

int count(const char str[], const char key[])
{
** *** ** * ** ** * * **** ** **
* *** * **** **** * * ** ***** * ** key);
* * * * * * **** ** ***
** *** **** * ** *****
** ** ****** * *** * ***** * * * * ***
**** **** *** * ** ** * * * * * * **** ** * ** *
* * *** * *** * * * * ** ******* key);
**** * * *** * **
* ** * * * * *** * * count;
}
answered by (190 points)
0 0
prog.c: In function 'main':
prog.c:9:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(str);
    ^~~~
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:10:4: warning: 'gets' is deprecated [-Wdeprecated-declarations]
    gets(key);
    ^~~~
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/cc24SSNn.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main(){
* ****** ****** * * * * ** s1[1000];
** *** * *** ** * * ***** s2[1000];
* *** * * **** *** *** s3[1000],s4[1000];
* * ** * ** * * **** i;
* * * * **** **** ** * * s1,s2
* *** * ** ** *** * * * * ** * * %s",s1,s2);
** ** **** * ** ** * s1 to s3,s2 to s4
****** * ***** * * * * * ** * *
* ** ** * ** *** *** ** * *
* ** *** *** ** *** ** * *** *** s1 to ALL uppercase
* * ** * ** *** *** ** * * * *** * ******
** * ****** *** * **** **** * * * ** ** * * *** ** * ** ** * * ** *
* * ** *** * ** ***** * ********* ** * * **** *** * * ** ***
    }
*** ** * * * * * * * *** * s2 to ALL lowercase
** ** * * * * ** **** ***** * ** **
*** ****** * ********* * * * ** **** ****** ** ** *** * ** * ** *** * ****
** * * *** * * ** ****** ** * ** ** * ** ** * * *** ******** ** * ** *
** * ** * * * * * * ** *
**** * * ** *** * ** s1,s2(be converted to all uppercase)
* * ** * ** * *** * **** **** * *
** * * **** * * ** * * * ** * *** ** ** *** == %s",s3,s4);
**** **** * * ** * * * *
* ** * *** * * * * * if(strcmp(s1,s2)<0){
* * **** * * ** ** * * * ******* **** ** * * **** > %s",s3,s4);
** **** * * * ** * *
* ** ** * * *** * * ** * if(strcmp(s1,s2)>0){
* *** ***** * ** * * * * *** *** * *** < %s",s3,s4);
* * * * *** * * ***
* * * *** * * ** *** 0;
}
answered by (212 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main(){
** * * *** * * * * *** **** * s1[1000];
***** ** **** * * * *** s2[1000];
** * *** *** * * ** ** * *** s3[1000],s4[1000];
**** * ** ** ***** * i;
* **** ***** * * * * * * * s1,s2
* *** * ** ** ** ** *** *** ** * %s",s1,s2);
* * **** ** *** * *** ** s1 to s3,s2 to s4
** * * *** ** * * ** ****** ***
* ** * ** * * * *** * * **
**** * * * ** ** ** * s1 to ALL uppercase
** * * ** * * * * ** * ** ** * * *
* * * **** * * *** * * * ** * *** * ** * * * * * * * * * *** * * * ***
** * ** ** ***** * ** * * * ** * ** * *** * *** ** * * *
    }
* * * * ** * ******* * * s2 to ALL lowercase
* ** *** * *** *** * * * ** * *** * **
* ** * * * ** * * * *** * * * ** * ***** ** * ** ** *** ** * ** * ** *
* * * ** ** * * ****** **** * ** ***** ** * * **** ** ** ** ** *
** **** **** * * *
*** *** * ** ***** ** s1,s2(be converted to all uppercase)
* * ***** ** * *** ** * **************
* * * * * * ** ** ** * * *** * * ** * * * * * == %s",s3,s4);
****** ** ** *
* * ** * * ** * * if(strcmp(s1,s2)<0){
* * * * ** * ** ** * * *** * * ** **** * * * *** > %s",s3,s4);
* * * * ***** * * * *
* * ***** ** * * * * ** * * if(strcmp(s1,s2)>0){
* ** ** ***** *** * **** ** * ** ** * ** *** ** *** * < %s",s3,s4);
* * * * **** * ** ** **
* *** * ** ** *** **** 0;
}
answered by (194 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.130.191
©2016-2025

Related questions

2 like 0 dislike
24 answers
[Exercise] Coding (C) - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 33762 - Available when: Unlimited - Due to: Unlimited
| 3.7k views
3 like 0 dislike
22 answers
[Exercise] Coding (C) - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 33757 - Available when: Unlimited - Due to: Unlimited
| 4.4k views
3 like 0 dislike
6 answers
[Exercise] Coding (C) - asked Nov 30, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 34979 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
3 like 0 dislike
9 answers
[Exercise] True/False - asked Nov 16, 2017 in 2017-1 程式設計(一)AD by 楊修俊 (30k points)
ID: 33763 - Available when: 2017-11-16 14:00 - Due to: 2017-11-16 14:30
| 805 views
3 like 0 dislike
5 answers
[Exercise] Coding (C) - asked Nov 30, 2017 in 2017-1 程式設計(一)AD by Shun-Po (18k points)
ID: 34978 - Available when: Unlimited - Due to: Unlimited
| 1.5k views
12,783 questions
183,442 answers
172,219 comments
4,824 users