0 like 0 dislike
5.7k views
Show more...
[Exercise] Coding (C) - asked in Chapter 8: Arrays by (5.2k points)
ID: 39985 - Available when: Unlimited - Due to: Unlimited

edited by | 5.7k views

31 Answers

0 like 0 dislike
Hidden content!
#include *** * *****
#include **** *** * * *** *
#define Max 1000

void * ** *** [], int []);
void ** *** *** * [], int []);

int main()
{
*** * **** * ** * **
* ** **** ** * * c, count[26] = {0};

** * *** * * * * ** Max, stdin );

** ** * *** * *** *** *** count);
* ** *** * ** * *** count);


****** ***** * ** **** (c = 0 ; c < 26 ; c++)


* * * * * *** *** * * * *** *** *
** ** ** * * * * ** * * **** ** *** * * ** * * ** ** ***
* *** * *** * * * * ** ** **
******* * * *** *** * * *** * ** *** ** * * * ******* ********* * ** * c + 'A', count[c]);
* *********** *** *** ** * ** *******
* *** * **** ** ** * * ** * * *** *
*** * *** ** * * ** * * * ** * * ** ** ** * * * * * *** * * * * * c + 'A', **


* *** * * ** * 0;
}
void ** * * s[], int count[]) {
**** * ****** * ** c = 0;

* * * * * * * (s[c] != '\0') {

** * ** * ** * * ** ** * ** ** (s[c] >= 'A' ** ** ** s[c] <= 'Z'  )


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

*** ** * *** * **** ** * * * ***
* ***** * ** *** * ***
}

void * *** **** s[], int count[])
{

** **** * ** *** **** * c = 0;

*** **** * * * (s[c] != '\0') {

* *** * * * ** * ** *** ** * *** (s[c] * * ** ** *** )


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

** * ** ** ** * ** * ** * * ****
****** * * * ** *
}
answered by (-140 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include<string.h>
int main()
{
**** * **** *** **** i,c,r,s, tab[100];
* * * ** * ** ** ** a,chaine[1001];
*** **** * * ** * * ***** * *** *** *** *
*** * * ** ** ** ** ** * * *
* * *** * ** * * *** ** * * * * *
*** * * * * ** *** *** **
** ** ** *** ****** ***** (a='a';a<='z';a++)
** * * **** **** ** ** *
**** * * * * ** *** **** ** * * ******* * * * * * *** * **** ***** **
** **** * * ** ** *** * ***
* * *** * **** *** * * * ** ** * **** *** *** ((chaine[i]==a) || (chaine[i]==a-32))
* * ** ** * * * ** *** * *** **** * * * * * *** **
* ** ** * * ** ** * *** ***
** * * * ** ** ** * *
*** ** ** *** ****** **
* * * * *** ** * **** (c=0;c<=25; c++)
* *** *********** *
* * * * * * ** ** *** * ** * ****** * * * (c<25)
* * ********* * * *** * ** * *** * **** *** ** * ** %d\n",(c+65),tab[c]);}
** * ** * * * ** ** *** * ***********
* * * * *** ** *** ** * ** * *** *** * ** * * %d",(c+65),tab[c]);}
* * * * * * ** * ** *
**** * * ** * *** * * 0;
}
answered by (-168 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
prog.c: In function 'main':
prog.c:7:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(chaine);
     ^~~~
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/ccLui6ys.o: In function `main':
prog.c:(.text+0x26): warning: the `gets' function is dangerous and should not be used.
0 0
prog.c: In function 'main':
prog.c:7:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(chaine);
     ^~~~
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/ccZnZnXG.o: In function `main':
prog.c:(.text+0x26): warning: the `gets' function is dangerous and should not be used.
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
int main()
{
* *** **** ** * * *** * **** **** * * * * ** *** * **** * * * * * ** * * ** * * ** *
** ** * * *** ** *** * ** ** ** ** * * ******* *** * * **** ** ***** ** * ** * * *
    int c[50]={0};
* * * * * * * * ** d[1000];
    int n,i,j,l,z=0;
*** * **** * ****** ** *
* * *** ** ********* ** ****
** * * * * *** ** * ** (i=0;i<n;i++)
    {
* ** * * * * ** ** ** * *** * ***** * **** ** * (j=0;j<26;j++)
** * ** ** * **** * ****** ** ***
****** * * * * * ****** * ** * **** ** ***** * * * * *** (d[i]==a[j]||d[i]==b[j])
** ** ** * ** *** ** * * ** **** *** * * *** ***** ***** * * * ** * * * **
** * * *** * ** ** ** ** * * * ** * *** * * * ** * * * ** * ** **** *** * * ***** * * *
**** * * * * * **** * * * * * ** * *** ** **** * ** * * *
** *** * * ** ****** * * ** *** **** *
    }
**** ** * * *** * (l=0;l<26;l++)
    {
*** * * ***** * *** ****** *** * * * ** *** (z==0)
* * * * **** * * * * ** **** * ** ***** *
* **** **** * * **** * * * * * **** * ** **** * ** **** * * *** * * * ** **** **** * %d",b[l],c[l]);
* *** ** *** *** * ***** ** ** ** ***** ***** * * ** * * **
*** * * * * * * * * * * * ***
* * * * * **** * * ** * *
* * * *** ** **** *** * * * ** * * ****
* * *** * ** ** ** ** * * * * * *** * ** * * ** *** ***** **** ** **** **** * * %d",b[l],c[l]);
**** * * * * * * ** * **** * ****** **
    }
** * * * ** ** * ** * *** 0;
}
answered by (-229 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include ** * * ****
#include **** ** * ** *
#include ***** ** * *
#include ** ** ** **
void ** **** *** ** src,char* dsc)
{
* * * * * * for(int i = * * ** *
* ** * ** dsc[i] = * ** ****
}
int main()
{
*** * ** * * char ******
** * * * char t[1000];
* * * * gets(t);
** * ** * * * *** *
** * *  

* * ** * * for(char * * *** * * **
* * * {
* *** * * * ** ****** * int count=0;
** ***** * * * ***** *** ** for(int ** *** * *
* ** * * * * * * * {
* * * * ******* **** ** * * * *
***** ** * ** ** **** * ***** * ** * ****
** **** ** ** * * * * * *** ** * * * * {
* * * * * **** **** ** ** * * **** * * * * ** * count++;
*** * * * **** ** * * ** * * **** }
* * *   * * * * *** * }
* * * * * * * * * ** *** ** *
***** ** * ***** ** * *** * ** *
* ** ****** * * * * *** * * * * * ** * * *** **** ** ** **** *** * *****
* * ** * * ***** * * ** * ** **
* * * **** * }
* ***
*** * ** * getch();
}
answered by (-214 points)
0 0
prog.c:3:19: fatal error: conio.h: No such file or directory
 #include <conio.h>
                   ^
compilation terminated.
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>

int A[26];//大寫
int a[26];//小寫

int main()
{
*** ****** * **** * * * * i;
* **** * * *** ****** * n[10000];
* * ***** *** ** *** ** * **** ** **** * **
** * ** ** * * * ***** * *
** **** *** * * ** ********** *** ** * *
* ** * * * ** **** *** *
** * * * * * ** ** * ** ** *** ** * * *** * **** && n[i]<='z')
** * * * ** *** *** * * * * * ****** * *** **** *** ** ** * * * * ** * * * *
* *** *** ** ** **** **** ***** ** * * **** ** * ** * * if(n[i]>='A' && n[i]<='Z')
* * * * * ******** **** ** ** ** ** ****** * * **** * ** *** ** * * *** ** ** * * *
**** * * ** * * *
* * **** ** * *** * * * * * * *
* * **** **** * ** ** * * * * ** * ** * || a[i]!=0)
* * * ** ** ** * * *** * ** *** *** * ****** * ** ** %d\n",i+'A',A[i]+a[i]);

* * * * * * *** * ** ** 0;
}
answered by (-32 points)
edited by
0 0
prog.c: In function 'main':
prog.c:16:38: warning: multi-character character constant [-Wmultichar]
          else if (n[i]>='A' && n[i]<='Zq')
                                      ^~~~
0 0
prog.c: In function 'main':
prog.c:12:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(n);
     ^~~~
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/ccfK7LFr.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
0 0
prog.c: In function 'main':
prog.c:12:5: warning: 'gets' is deprecated [-Wdeprecated-declarations]
     gets(n);
     ^~~~
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/cc7Hbocl.o: In function `main':
prog.c:(.text+0x25): warning: the `gets' function is dangerous and should not be used.
0 0
prog.c: In function 'main':
prog.c:11:15: warning: format '%[^
   ' expects argument of type 'char *', but argument 2 has type 'char (*)[10000]' [-Wformat=]
     scanf("%[^\n]",&n);
               ^
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include * * ** *
#include ** * *** *
#define Max 1000

void *** ** [], int []);
void * ***** [], int []);

int main()
{
** * * *** ** * * * **********
* ** **** * * c, count[26] = {0};

** ***** * * * * ** ******* Max, stdin );

* * *** ****** * ** **** * count);
* * * * ** *** *** * ** count);


*** ** * ** ** * (c = 0 ; c < 26 ; c++)


* * ** * *** ** * * ****** * ** *
**** * ** **** ** * * * * * * ** ***** * **** *** * * **
** * ***** * ** * * * * * *
**** ** ** * ** * * ** * * * *** *** **** * ********** * ** * * c + 'A', count[c]);
**** * ***** *** ** ** * * ** * ** *
* * * ** * * ** * *** * * ***
*** *** * * ** * * ** * * **** ** * ***** * ** ** c + 'A', * ** ***


* ***** * * ** ** ** 0;
}
void **** * s[], int count[]) {
**** * ** * c = 0;

*** *** *** **** (s[c] != '\0') {

* *** *** * * * *** **** *** ** (s[c] >= 'A' *** ** ***** s[c] <= 'Z'  )


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

** * ** ***** ** * ** ** ** ** **
* ** ** **** **
}

void * ** ** * s[], int count[])
{

** ** ***** * * ** c = 0;

* * * * * **** (s[c] != '\0') {

** * *** ** * * * ** * * ** * (s[c] ** * ** **** * * *** ** )


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

* * * * ** **** * *** ** **** ** *
** * * * * *****
}
answered by (-167 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main()
{
** * * *** **** * ** * string[1000];
*** * * * * ** * * ** c = 0, count[26] = {0}, x;
* *** ******* **** * ***
* ***** * * * ** ** * ** *** *
* ** ** *** * ** **
* * ******** * (string[c] != '\0') {
* * **** * * * * * ** * * * * ** ** **
** *** *** ***** * * *** * * * * * * **** (tolower(string[c]) >= 'a' && tolower(string[c]) <= 'z') {
* * * * *** * * *** * * **** **** ** *** * * ** * * ***** * * = tolower(string[c]) - 'a';
* **** * ** * ** * * ** ** * * ** * * ** * ** * *** ** ***** * * *
* * * * * ** * * ** *** ** * * ** *****
* * ** * * *** ** *** * * * **** * * * ** **
*** ** * ** * ** * **** * * * * ** * **** **
** *** * **** ** *
* * * ***
** *** * ** * * (c = 0; c < 26; c++){
* * ****** **** ** * * **** * * * * ****** *
* ** ** * * * * ** **** ** ** ** * * %d",c+'A',count[c]);
*** * *** * * * * * * * * * * **
**** * * ** ** * ** * ** ** * *** * * ***** (c != 25)
* ** * ** *** * * *** * * *** * * * * * ** * **
* * ******** * * * ** ** *** ** *** *** * ** ******* *** * * ** ** * * * *****
** ** * ** ** * * ** ** * * ****
* ** ** ** * * ** *
    
*** * * ** ****** * * 0;
}
answered by (323 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include * ** * * * ***
#include * ** ** * *** *

int main()
{
* * * * ***** ** **** * string[1000];
** **** * * * ***** * * * c = 0, count[26] = {0}, x;
** * * * * * * **
*** ****** *** ***** ** ** * ** ** * ***
** *** ** * * ** * **
* * ***** ** ***** * ** * (string[c] != '\0') {
*** *** * *** *** * *** * * ******** * ** * *
** * ** * *** * ** ** * ** **** * ***** ** * * ** (tolower(string[c]) >= 'a' && tolower(string[c]) <= 'z') {
* ** *** * * * * *** **** * * * *** ** **** * ** ** * ** * * *** = tolower(string[c]) - 'a';
** *** * *** ** *** * ** * *** * * * * * * **** ** ** *** * *
** * **** * *** * * ** **** * ** ** **** ** * *
******** ** ******* * ** * ** * * *
* * ** ** * * ** ** * *** * * *
** * ***** * ****
* ** ** * *******
* * * **** * *** * ** (c = 0; c < 26; c++)
** ** ** *** * ** * ** ** * *** **** * ****** %d * ** *
* *** * * * ** * *
* * ** **** * * ** *** 0;
}
answered by (-193 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
* ** ** **** ***
* * ** **** ** ***

int
{
** * * ** char * *

*** ** *** * * * = **

** ** ** * *** * *** *
** * * *
** * *** * ** int len = **** **
* * * ***
* * **** * * int j = 0;

* * * * * ** * i = 0; i ** * * i++)
** * * ** {
* ** *** * * * * ** ** * = 0; j * 26; j++)
** ** * * ** ** {
* *** *** * * * * * ** ***** == 'A' + j || ** == 'a' + j)
** * ** * ** * *** * ** * * ** * {
*** * * * * * * ** * ** ** ** ** **** ***
* * * ** * * * ****** * * ** }
**** * * * * *** ** ***** * }
******* ** * }
******** ** ** ** = 0; j * * ** 26; j++)
* ** * * **** * ** **** == 25)
***** * ** * * * *** *** * ** * * * * ** ** * 'A' + j, **
**** ** * * * ** * **
* ***** **** ** * ** * ** * * ** *** ** ** * ** ** 'A' + j, ** **
}
answered by (-285 points)
0 0
prog.c: In function 'main':
prog.c:11:12: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
  int len = strlen(a);
            ^~~~~~
prog.c:11:12: warning: incompatible implicit declaration of built-in function 'strlen'
prog.c:11:12: note: include '<string.h>' or provide a declaration of 'strlen'
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
char string[1000];
int ii,jj;
int ** * * ** ** * * ** **** * **** * * * * * * * * ** * *
int main()
{
    fgets(string,1000, stdin);
*** **** *** * ** * ** * * ** ** **
*** **** ** * ***** ** * *** * * * * ** ******* * * **** * * **** *
* * ******* *** ** * * ** * * *** **** * ** ** **** * *** **
***** * ** * * *** * ** * *** ** **** * * ** *** ** * ** ****
** ** * ***** * ***** *** * * **** ** ** ** *** * *** **** * * *** *
** ** **** ******* ***** * ** * ** * * * * * * *** * * * * *** * ****
*** ** **** * * * * * ** * * * * *** * **** * ** *** *** ***
**** *** ** * * *** ** * ** *** ** * * * ** ***** *** *** ***
**** **** * **** * *** **** *** * * * * * **** **
* * * * ***** ** ** ** * **** * * ** * **** * ** * * ** * ****** * * *
** ***** * * * * * * ** * * * * *** ** ** * ** ** * ** ** * * *
* * * *** ***** * * **** ** * ** * * * **** *** ** * *
** *** * *** * ** ****** * *** ** * ** * * *** * * **** * **** *
* * ** ***** * * ** ** ** * * *** * ** *** * * ** *
* * ** ** * * ** *** ** * ** ** ******** * ** ***** ** * * * * **
* ** ** * * * **** ** **** * * * * ** * **** * ** *** ** * * * ***
** * * ***** *** ** * ***** * * ** * * ****** * * ** **** **** **
* * * ** ***** ** * **** * * ***** * ** *** ** * * ** ***** * **
*** ******* * ** * * * ** * * ******* ******* ** * * ** *** * * *** **
** * *** ******* ***** ** **** * * ** * * ******* * ** ***** * **** * *
** * * * ** ***** ** * *** * ** ** * * * * ****** ** *** * ******* * *
** * * * ** ** * *** * * ** ** * * ** ** ** ******* *** ********** * * *
*** ** * * *** * *** ** * * * ** * ** * * ** * * ** * ** ** * **
**** * * * ****** ** * ***** * * *** ** ** * ** * ** * ** * * * * *
*** * * * ** * * * **** * ******** *** *** * * * * * * ***
******* ** * **** ** * *** * * ********* * **** **** * * **** **
** ** * *** *** * * * * * * * ** * ** **** ** *** * * ****

    }
    printf("A %d\n",a);
    printf("B %d\n",b);
* ** * ** *** * * * ** * *** ** %d\n",c);
**** ** ** ***** *** * * **** * %d\n",d);
**** * *** ** * * * ********* * * * * %d\n",e);
* *** * * ***** *** * **** **** *** * %d\n",f);
***** ** *** * * * ** * * * **** %d\n",g);
*** *** *** * *** *** ** * *** * %d\n",h);
* * * ******** * *** * * * *** ** %d\n",i);
** ** * ** **** ** %d\n",j);
* * * **** * * ** * * * ****** *** %d\n",k);
* *** * * * * *** ** * ** %d\n",l);
* ** ** *** ****** *** * * %d\n",m);
* * * ** * * * * ****** ******* * %d\n",n);
* ** * * ** * *** **** * * *** %d\n",o);
** *** * ** ****** * * * * %d\n",p);
** ** **** * ** * *** * ** * %d\n",q);
* * * *** ** * * * *** * ** *** * %d\n",r);
*** *** * ** * ** * * * *** %d\n",s);
* * * *** * ** *** ***** * ** ** * %d\n",t);
* * * ***** ** * * **** %d\n",u);
**** **** *** *** * **** *** ******* %d\n",v);
    printf("W %d\n",w);
    printf("X %d\n",x);
    printf("Y %d\n",y);
** ** * * * ** ** * * *** ***** * %d",z);

    return 0;
}
answered by (-284 points)
0 0
Case 0: Correct output
Case 1: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.17.62
©2016-2025

Related questions

0 like 0 dislike
102 answers
[Exercise] Coding (C) - asked Dec 28, 2017 in Chapter 8: Arrays by semicolon (5.2k points)
ID: 39984 - Available when: Unlimited - Due to: Unlimited
| 12.6k views
0 like 0 dislike
56 answers
[Exercise] Coding (C) - asked Nov 29, 2017 in Chapter 8: Arrays by semicolon (5.2k points)
ID: 34913 - Available when: 2017-11-30 18:00 - Due to: Unlimited
| 6.9k views
12,783 questions
183,442 answers
172,219 comments
4,824 users