4 thích 0 k thích
10.1k đã xem

給予一個數列,請寫一個程式找出其中最大的數,最小的數,以及出現最多次的數。

 

輸入說明:

一開始會先輸入一個正整數N,N不會超過1000,接下來的N個正整數就是要處理的數列。

 

輸出說明:

請依序輸出三個數,分別代表最大的數,最小的數,出現最多次的數。如果出現最多次的數不只一個,請輸出其中最大的那個。

 

輸入範例:

5
1 1 2 2 3

 

輸出範例

3 1 2
[Exam] đã hỏi trong 2017-1 程式設計(一)AD bởi (30k điểm)
ID: 38940 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 10.1k đã xem

16 Trả lời

0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
*** *** * **** ** * ** * * * ** * * * *
* * ** *** * *** arr[x],amount[x];
*** * * ** * * * * i;
* ** *** *** * ** * ** * * *
* * * * ** ** **** * * ** ** ***** *** *** ** ** * * * *** ** *
** *** * * ** * *** * ***
    int j;
* **** * **** * * * * * *** * *
    {
* * ** * ** ** * * * * ** * ** * * *** ** ** *** *** * *
** ** * * * ** ** * * ** * ******** ** * * ** * ** * * ** * **** *
* * * * ******* ** * * * * * * * ** *** **** ** * *** *
* ********** ** *** *** ** * * **** * * * * ** ** *** * * * * * * *
    }
* * * * * * *** **** ** **** * *
    {
* * * * * * ***** *** **** * * *** ** ** ** ** ****
* **** * ** ** * * *** * ** * **** ** **
* *** * * * ** * ** * * *** * ** **** * * ** *** * *** * * ** ***
* ** ** * ** * * *** ** * ** * * * *** ** * * * * * * *** *** * * * ******* * ** ** ** *
** ***** ******* ** * * * * * * **** ** *
    }
    int temp=0;
* * * ** *** *** ** * **** *
    {
* * * * ** * * ** * ** *** ** * *** ** **** *** ** * * ******* ** *** ** * *** *
* * * *** *** ** * ** ** **** * * * **
* ** * ***** **** *** * ** * **** ***** ** * * * ** *
* * * ** * *** * * ** **** **** * * ** * ***** **** * * ***
* ** ** ******* ** * ****** *** *
    }
**** * * ** ** ***** ** * **** %d %d\n",max,min,arr[size]);
* * * ** * * ** *** 0;
}
trả lời bởi (160 điểm)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
include<stdio.h>

int main()
{
*** ** ** * ********* * ** ** n,max=0,min=0;
**** * *** *** *** **** num=0,temp=0;
* * * ****** * *** * * *** ** ****
* ** ** * ** * ** ** * ** * arr[1000],amount[1000];
** ** ** * * * * * * * i;
*** * * * ***** * * * * ** *
**** ** * ***** **** * ** ** * * *** ** * ***** * * * * *** ** ***
* * * * *** * ** *** ** * ***
* * * ** **** * ** **** * j;
    
** * **** * * * ** ** ** * * *
    {
**** * ********** * *** * ***** ** ** ** *** *** * *
*** ****** * ** ***** * **** ** **** * * * ** * ***** ******** **
** * *** ** * * * ** * * * * ** * * * * * ***** ****
** * * * * * * * * * ** ** * ** * ** ** ** ***** * ** ***** * * *
    }
* **** *** *** * ** ** * **** ***
    {
* * ****** * * ** ***** ** ** *** * ** ******* ** * ***
* *** *** ** * * ** * **** ****** ** ****** *** *
* ** * * ***** * * ** ** * ** ** ***** *** *** *** ****** * * * *
**** ** ***** *** * * * ****** ** *** * * * * * ** * * * ** * * * *******
** ** ** *** * * ** * * * ** *** **** *** ***** *
* * * * *** * * **** * *
   
    
* *** ** * ** * * * * *** ** * *
    
    {
****** ** ** * ** * * **** **** ** ** ** * * *** * * * ** * * ** **** * ** * * *
** * * *** * * * ** * ** ** ******
* * * * * * * * ** * ** **** **** * ** * ** * * ** *** **
* ** * * * ***** * *** * * * * * * * ** *** * ** * * ** ***** * * *
** ** ** ***** * * *** ** * *
    }
** ** ** * * * * * ** *** %d %d\n",max,min,arr[num]);
* * ** **** * * * * * 0;
    
}
trả lời bởi (174 điểm)
đã sửa bởi
0 0
prog.c: In function 'main':
prog.c:11:18: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
          scanf("%d",arr[j]);
                  ^
prog.c:13:8: error: 'max_length' undeclared (first use in this function)
     if(max_length<current_length)
        ^~~~~~~~~~
prog.c:13:8: note: each undeclared identifier is reported only once for each function it appears in
prog.c:13:19: error: 'current_length' undeclared (first use in this function)
     if(max_length<current_length)
                   ^~~~~~~~~~~~~~
prog.c:18:20: error: expected expression before '{' token
     current_length={0};
                    ^
prog.c:22:36: error: 'n' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                    ^
prog.c:22:41: error: 'max_lenhth_num' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                         ^~~~~~~~~~~~~~
prog.c:22:55: error: expected ')' before ']' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                       ^
prog.c:22:55: error: expected ';' before ']' token
prog.c:22:55: error: expected statement before ']' token
prog.c:22:56: error: expected statement before ')' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                        ^
0 0
prog.c: In function 'main':
prog.c:11:18: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
          scanf("%d",arr[j]);
                  ^
prog.c:13:8: error: 'max_length' undeclared (first use in this function)
     if(max_length<current_length)
        ^~~~~~~~~~
prog.c:13:8: note: each undeclared identifier is reported only once for each function it appears in
prog.c:13:19: error: 'current_length' undeclared (first use in this function)
     if(max_length<current_length)
                   ^~~~~~~~~~~~~~
prog.c:18:20: error: expected expression before '{' token
     current_length={0};
                    ^
prog.c:22:36: error: 'n' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                    ^
prog.c:22:41: error: 'max_lenhth_num' undeclared (first use in this function)
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                         ^~~~~~~~~~~~~~
prog.c:22:55: error: expected ')' before ']' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                       ^
prog.c:22:55: error: expected ';' before ']' token
prog.c:22:55: error: expected statement before ']' token
prog.c:22:56: error: expected statement before ')' token
     printf("%d %d %d\n",arr[0],arr[n-1],max_lenhth_num])
                                                        ^
0 0
Case 0: Wrong output
0 0
prog.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
0 0
prog.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
0 0
prog.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
 include<stdio.h>
        ^
0 thích 0 k thích
Hidden content!
#include<stdio.h>

int main()
{
    int temp,n,most,mostt=0,big,small;
    int i,j;
    
** * * * ***** * * * ** * * ****** ***** * ******
    
    int input[1000]={0};
    
** * ****** *** ** * ** *** *
*** * ** ** ** *** ** * *** *** **** * ** **** * **
    
**** * * **** ***** * *** ** ** *
    {
****** * * ** * * ** * * ** * * * * ******* **** * * ** * * ****** * ** *** ** * * * * ******* * * t=0;
* * **** *** * ** ***** ** ** * * ** * * * * ***** * * * *** * * ** ** *** * * * * * * * *** ***** **
* * * * * *** * * * * * *** * ** * *** ** ** ** **** ** * ** * *** * * * * ** * ** ** ** ****
* ** * * * ** ** ** * ** *** * * * * * * * ********** * ******* ** * * ** * ** **** ** ****** * * ** * *** * * ** ** * ** ****** *** ** ** * ** *** ***** * * *** **** * * ** ** **
** ** * ** * ** * * *** ** ** ** **** **** ** **** * **** * * * * *** * **** ******* ** *** * *** *** * ** *** * * * *** * ********** * **** ***** *** *** * * * ********* *** ** *** *
* *** * ** * **** *** * * * * ** * ** ** * *** ** ** * * * * * ** ** **** ** ***** * * * * ****** ** * **
* ** * * *** * * ** ** ** * * * ** * ** * *** *** * *** * *** * ******* ** * ** * *** ** **** && most<input[i])
* *** * ** * * * * **** *** ** ** * * * *** * * * * * * * ** **** *** * * ** **** *** * * **
** ** * * * * * ** * ** * * * ** ** * *** * * * * * * * ** *** * * * * * *** ** * ** * **** *** ** *** * * * ***** * ** ** * ***** * * * * * * * ** *
** ** * * ** * * *** * *** ** * ** ***** * * ** * ** ** * * *** ** * * * * * ****** ** ** ** * * * * *** **** **** ** * * * ** ****** * * *
* * ** * ***** ** ** **** ** ** ******** ** ** * * * * *** ** * * * * *** * ** * * ** * * **** * * * ** * ** *
    }
    
** * ** *** * ******** *** *
* * ** *** * ****** * ** * ** ** * **
    {
** * ** ** ** * * * * *** ** * *** * ** **** * * ***** *** * * * ****** ** ** * * * ** * ** ** **** *
* * * * ** * * * *** ** * * * ** ******** ** * *** ** * ** *** * ** **** ** * *** * ** * ** * *
    }
    
***** * * * ** * * * ** **
* ** * * * *** ** * * ** ** *** **
    {
*** * * * ** * **** * **** ** **** * * ** ** * * * * ** ** * * *** * ** *** **** ** ** *** * * ** * * ** *** ** * * *
* * **** ***** ** * * ** * * ** * ** * *** * ** * * * * * ***** ***** * ** ** * * * * **** ** *** ** **
    }
    
* * * * * ** * * *** * *** *** * %d %d\n",big,small,most);
    
    return 0;
    
}
trả lời bởi (215 điểm)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
** * ** **** * * ** ** * ***** * * ***** * * * *
* ** * * * * * *** * arr[x],amount[x];
* * ***** * * * *** i;
** * * * * * ** *** ** ***** ** * *
** *** * ** *** ** * * ***** ** * * * * ** * * ** *** *****
* * ** ***** *** * * * *** *
    int j;
* * ** **** ********* ** * **** **
    {
***** ** ***** *** * * * * ** * *** **** ** *
* ** * * *** ****** **** * ** ** * ** ** * * * **** * ** ** * * *
* * * * * * * *** ******* * * ** ******* * ***** * * *
** *** ** ** * * * * ** ** **** * ** *** * * * *** **** * * *
    }
*** * ** ******** *** * * *** ** * **** * ** *
    {
* * * * * *** ** * ** * * *** * ** * * * ***** *
** * * * * *** ** ** * * ****** *
* *** ** *** * * *** ** * *** *** ** ** * * * * ***** * **** * * * *
** ** *** * **** * * ** ** *** **** * * ***** **** * * * * ** **** * * *** * * * * ** * *** *
** * * ****** * * *** ** * * * ** * * * * * ** ** *
    }
    int temp=0;
* * ** ** ** ** ** ***
    {
*** ** ** *** * **** * *** ** ******* ** **** ** ***** * * ** ****** *** *** ****** *
****** *** ** **** * * * ** * * * * ***
* * ***** * **** **** * ** * ****** ** * * ** * ** ** * *
* ** ***** ** *** * *** * ** * ****** * * **** *** *** **
* * **** * *** * * *** * * ***
    }
* * **** * ** * ** ** * * * %d %d\n",max,min,arr[size]);
** **** * * * * * * * * **** * 0;
}
trả lời bởi (100 điểm)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
**** **** * * ***** * * n, current_num, current_num_length, max_length = 0, max_length_num, temp;
* * ** ** *** ***** ** i, j, k;
** * * * * * * * arr[1000];
** * *** ** ****** * ***** *** * ** ** ** *** * *****
    
* *** * ** * *** * * = 0;i<n;i ++)
    {
** * * ** * * ** *** * *** ** ***** *** * ** * * ** * * **** * **
** * * **** ** * ***** *** * *** *** *** * * * = i+1;j<n-1;j++)
******** * *** * * * * * * * * * ***
* *** ** * ** ** ******* **** ** * ***** * ** * ** ** ********* * * > arr[i])
* ** ** * * * *** * ** * * * * * *** ** * **   
* ** * * *** ** ** * *** **** * * * **** * ** * ** ***** ** ***** ** * =  arr[j];
* *** *** * ** * ** * * ** ** * ***** ** ** ** * *** * = arr[i];
***** * * *** * * * **** *** ** ***** * * ** **** ** ** * ** * * * = temp;
* * * ** * ** * * ** * ** ** * * ***** ***   
* * ** * *** * **** ***** * *** * * * **
    }
    
*** ** *** * * * * ** ** * ** * = arr[0];
* * * * * * * * ******** * *** = 1;
* ** ** * * *** * * * * ** * * **
* * ** * * *** * ** = 1;k<n-1;k++)
* ****** * * * * ** * **
* * *** * ** *** * * * * * ** ***** *** *** = arr[k])
** ****** ***** * * * ****** **** * ** ** **
* ** * * * * * ** * *** *** *** * * **** * * ***** ** * * * ++;
* ** * * * * *** *** ******** ** *
**** * ** ** ****** * * ** * ** **
** * **** * * * *** ** *** ** * ** ** **** ** ******* ******* **** = 1;
** * ** *** * * * ** * **** * * **** *** > max_length)
*** *** * ** ** *** *** * * *
* ** ****** * * ****** * *** ** * **** * * * *** = current_num_length;
* ** ** * **** ** * *** **** *** ** = current_num;
* *** ***** * ********* ** ** ** ** * * * ** * ****** ** * ** *
*** **** * * *** **** * * * **
* * ** *** **** *** **
* * * ** ******* ** **** ** %d **** * ** ** * ***** ***** * *     
    
**** * * ** * *** * ** * * 0;
}
trả lời bởi (212 điểm)
0 0
Case 0: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
* ** ** *** ****** * * **** * * * *******
** * * ** * * * ** * ** arr[x],amount[x];
** *** * ** ** *** i;
** ** ***** * * * ** * * ** ***
* * * ** * * ** * *** * *** * ** * * * ** * **** *** ** ** * ** **
* * ** * ** *** * ** * *** *
    int j;
** * *** * ** *** * ** ** * *** **
    {
* * ** *** *** * * ** *** ** * ** * * * *
*** ** * * **** * * ** * * *** *** * * *** * * *
* * * **** * ** * ** ** * * **** * * * * *** * *
*** * ** * ******* * ** ***** * * *** * * * ***** ***** * *
    }
** * * ** * * ** * *** **
    {
* ** **** * *** **** * ** ** ** ****** *** ** *** * ***
* * * * ** *** ** ** *** * * ** ** * **
* ** ***** * ** ** ** * ** ** *** * ** * * * * * * * * ***** *****
* *** * ** ** * * * * * ** * * ** ** *** * ** * * * ** * * ** **** ** ** ** *
* ** **** *** ******* *** * * ** ** * * * **
    }
    int temp=0;
** * * * ** ** * ** ** ** ** * * ** * **
    {
* *** * * *** * * ** *** **** * * * ** **** *** ****** * ** * * * * * * *
* **** *** * * *** * * ** ** * * *** ** * * ***
*** * **** * * ** * * * * * ** ** ** * *** * ** * ** * *** * * ****
** ** * * * * **** *** ** * ** ** * ***** * * ***** * **** * * **
* *** ** ***** * * * * * *** *** * ***
    }
* ** ** **** * *** * ** ** * * * * * %d %d\n",max,min,arr[size]);
* *** ** * *** * * ** * * 0;
}
trả lời bởi (190 điểm)
đã sửa bởi
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>

int main()
{
    int temp,n,most,mostt=0,big,small;
    int i,j;
* *** ** ****** * * * * *** * ***** * *
    int input[1000]={0};
* * * * * * * *** *** * ** * **
* ***** ** * * **** * * * ***** *** * * * **** * * ** *** ** * ***** ** ** *
*** * * ** *** * *** ** **** ** * **** ** *
    {
***** ** *** * *** * ** *** * **** ** * * ** * * * t=0;
*** * * * * ** * * *** * **** * * ** *****
*** * ***** * * * * * *** * * * ** * **
* ** * * ** * ** * * ****** * ** * *** ** * ** * * ** ** ** * * ******* **** ***
* * * **** ** * **** *** *** *** ** ** * ** * ** ** * * * ** *
* * * * ** **** * * * * *** ******* *** ** * *** ** ***** **** ** * * *** * * * * ** ** ** ** *
* **** * * *** * * * ****** * ** * * * ** * ** * *** *** * * * ** ** *
***** ** ***** * ** * * ************ *** ** **
***** * ** * * *** * ** * **** **** * * *** **** ****** * ** ** ** ** && most<input[i])
* * **** *** *** ***** ** ****** ** ** * *
*** * * ** * **** * *** * * * * ** * **** ** ****** * * * * ** *
* ** ****** *** ***** ** ** * *** *** * * ** * **** * ** *** ***** ** * * * ** * ** **
** *** ** * ** * ** * * * *** ** *** ***
    }
* **** * ** * ** ** ** * *
* * **** ***** * **** * ** * ** * *** **
    {
*** * * * ** * * * *** * * * * **** * * ****** *** *** * * * * **
*** * * * *** **** * ** * ** *** *** * ****** **
******* * ** ** * * ** ***** ** ** * * ** **** * ** *** * ***
* * *** **** * ** * ** * * ** ** ** ** * **
    }
* * * * * * * **** **** *** * *
* *** *** *** *** ** * ***** *** * *** * * **
    {
* * ** ** * ** * *** ** ** ** * * **** ** * * ********* * *
* ** * * * *** * ***** * ******
** * * * *** ** *** * * * * * * * ** ** * * * ****** ** * * ** * ** * **
* *** *** * * * * * *** * * * * * *** * **
    }
    printf("%d %d %d\n",big,small,most);
    return 0;
}
trả lời bởi (131 điểm)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int arr[1000];
    int i,j, n,count;
    int most=0,mostt=0,big ,small;
** ** ****** * **** * ***** * ** *** *** * ** *
* * * * **** * ** ** ** *
* * * ** *** * ** ** ** ***** * * * * **** **** ** ** **
* ** * * ***** * * **** *** * * *
    {   
* ** ** *** * ** * * ******* *** ** *
*** * ** ***** ** * * **** ** ** ** * * * * * ** *
* *** * ** * * * **** * * * * ** *********
* *** *** ** ***** *** * *** * * ** ** * **** * ** *** * * * * ** * *
* ** **** ** ** * * * * * * ** * ** * *** * * ** *** * **** * **** * ***
** * * * ** * * ** * * ** ***** * * **** * * * * ** ** * * * * *
* * ** *** * * * *** * * ** * ** *** * *** * * * * *** ** *** ** * * ** * * && arr[i]>most)
* ***** ** * * * ********* ** ** *** *** ** ** ***** * * ** * * * * * *
* **** *** ***** * ** *** * * * * * * * * * * ** ** * **** ** *** ** * **** *** * ** * * ***** * * *****
** *** *** * * ** * * * ** * * ** ** ** * *** * ** * *** * * * * * * ** ** *** **** * **
**** ** ***** * ***** ** * **** ** * ** * ** * *** * * ** * ***
* *** * * ****** *** * * * *** * * * ****
     }
     
* * ** ** * * * ** **** ******
* * *** * *** **** * **** * * * ****** ***
     {
* * **** ** * ** * * *** * * * ** ** * ** * **
****** *** ** ** ** *** * * *** * * * * ***** *** * ***
** *** * * ***** * ** *** * **
* ** * * ** * *** ** * *** ****
***** ** *** * *** * * * * ** * **
***** **** * ** ******** ** * ** * **
     {
* * ** * *** * * * ***** **** * * ** *** * * ** * *** ** * *
* **** * * * * ** * * ****** ** ** **
* ** *** * ** * ** ** * ** ** *
* ** ****** * * ** * *** ** *
** * * *** * *** * *** * ** * * *** * * ****** %d %d\n",big,small,most);
      
}
trả lời bởi (172 điểm)
đã sửa bởi
0 0
prog.c: In function 'main':
prog.c:9:16: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'char *' [-Wformat=]
        scanf("%d",&arr[i]);
                ^
0 0
Case 0: Wrong output
0 0
Case 0: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int n, temp, i, j,current num, current numlen;
* *** ** **** ** *** * **** *** * *** *
**** * * ** *** * ** * *
* * ***** ** ****** *** * ** * *** * * * **** * * * ** *
***** ****** * *** ** ***** * *
* ***** *** * * * * * * * * * ** ** *** * ** * ** * ** * * ** ** ** * ** ** **** * *** * * **** *
* *** * **** ** * *** **** * ** ** ** * ** **** *** * * * * * **
* ** * * **** ** * ** * * *** *** * *** *** ** **** *** *** **** * * * *
* ** *** * * * * ** * ** *** * * * *** *** *** * ** * * *** *** ** **
* * * ** * * * * ** * *** * * * **** ** * * * * * * **** ** ***** * ***
* *** * * ***** * *** * **** **
    }
    current num=num[0];
    current numlen=0;
* * * ***** ****** **** **** * **** * * num);
** ** **** * * *** ** ** *** *** * * *** * * * ** *
* *** * ******** * ** * *** ***
* * * * ** * * * * *** * * * * ** * *
* ** * *** * ** ** ** * ******* ******* * ** **** **** numlen++;
** ** ** * * ** * ** ****** * * ** ** * if(num[i]!=num[i+1])
**** * *** ** * ***** ** **** *** *** *** * ******* num=num[i+1];   
    } * * * * * ** * *** **
**** * * *** * ** * *** * ** * *** * ** numlen); ** **** * * *** * * * **
* * * * ******* ** ** ** **
    return 0;
}
trả lời bởi (144 điểm)
0 0
prog.c: In function 'main':
prog.c:4:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'num'
     int n, temp, i, j,current num, current numlen;
                               ^~~
prog.c:7:20: error: 'num' undeclared (first use in this function)
        scanf("%d",&num[i]);
                    ^~~
prog.c:7:20: note: each undeclared identifier is reported only once for each function it appears in
prog.c:9:25: error: expected ';' before ')' token
        for(j=i+1,j<n;j++){
                         ^
prog.c:16:5: error: unknown type name 'current'
     current num=num[0];
     ^~~~~~~
prog.c:16:20: error: subscripted value is neither array nor pointer nor vector
     current num=num[0];
                    ^
prog.c:17:5: error: unknown type name 'current'
     current numlen=0;
     ^~~~~~~
prog.c:18:17: error: 'current' undeclared (first use in this function)
     printf("%d",current num);
                 ^~~~~~~
prog.c:18:25: error: expected ')' before 'num'
     printf("%d",current num);
                         ^~~
prog.c:19:20: error: subscripted value is neither array nor pointer nor vector
     printf("%d",num[n-1]);
                    ^
prog.c:21:14: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
              ^
prog.c:21:22: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
                      ^
prog.c:22:19: error: expected ';' before 'numlen'
           current numlen++;
                   ^~~~~~
prog.c:23:19: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                   ^
prog.c:23:27: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                           ^
prog.c:24:19: error: expected ';' before 'num'
           current num=num[i+1];
                   ^~~
prog.c:26:25: error: expected ')' before 'numlen'
     printf("%d",current numlen);
                         ^~~~~~
0 0
prog.c: In function 'main':
prog.c:4:31: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'num'
     int n, temp, i, j,current num, current numlen;
                               ^~~
prog.c:7:20: error: 'num' undeclared (first use in this function)
        scanf("%d",&num[i]);
                    ^~~
prog.c:7:20: note: each undeclared identifier is reported only once for each function it appears in
prog.c:9:25: error: expected ';' before ')' token
        for(j=i+1,j<n;j++){
                         ^
prog.c:16:5: error: unknown type name 'current'
     current num=num[0];
     ^~~~~~~
prog.c:16:20: error: subscripted value is neither array nor pointer nor vector
     current num=num[0];
                    ^
prog.c:17:5: error: unknown type name 'current'
     current numlen=0;
     ^~~~~~~
prog.c:18:17: error: 'current' undeclared (first use in this function)
     printf("%d",current num);
                 ^~~~~~~
prog.c:18:25: error: expected ')' before 'num'
     printf("%d",current num);
                         ^~~
prog.c:19:20: error: subscripted value is neither array nor pointer nor vector
     printf("%d",num[n-1]);
                    ^
prog.c:21:14: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
              ^
prog.c:21:22: error: subscripted value is neither array nor pointer nor vector
        if(num[i]==num[i+1])
                      ^
prog.c:22:19: error: expected ';' before 'numlen'
           current numlen++;
                   ^~~~~~
prog.c:23:19: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                   ^
prog.c:23:27: error: subscripted value is neither array nor pointer nor vector
        else if(num[i]!=num[i+1])
                           ^
prog.c:24:19: error: expected ';' before 'num'
           current num=num[i+1];
                   ^~~
prog.c:26:25: error: expected ')' before 'numlen'
     printf("%d",current numlen);
                         ^~~~~~
0 thích 0 k thích
Hidden content!
#include<stdio.h>
int main()
{
    int x,max=0,min=0,size=0;
* ***** * ** ** ***** *** * * * *** **
* * ** * ** ***** * * ** * arr[x],amount[x];
***** ** * ** * * ** i;
** ** * * ** * * **
** * ** * ** **** ** ** ** * **** * * * ** ** * * * **** * *** ***
* * ** **** * ** ** * *
    int j;
* * * * *** ** * * **** ** ***
    {
* * *** ** *** * * * ** * *** *** * * * * ** * * ** *
* * ** ** ***** *** *** ** *** ** *** ** ** ***** *** *** * **** ***** * ** *
* ** * *** * ** * **** * ** * *** * * *** **** ***** * *** *** * ** *
*** * ******** * * **** * ** * ** ***** * * * **** *** ** *
    }
* * * * ** * ** * * * * * **** * *
    {
** ** * * * *** **** ***** ** * * * ** * * *
**** * ***** * * *** * ** * ** ** **
** *** **** * ** * ** * *** * * ** * * ******* * * ***** *** *** ** *
** * * *** * *** *** ** * * * ****** * ** * *** * * ** ***** ** ***** ** ** ** * * ** *
**** * ** * * * * *** ***
    }
    int temp=0;
* * ** * ***** * * ** *
    {
* * * *** * * * ** *** * * * ** * * *** * * * ******* * ** ** * * *** *** **
***** *** *** * ** * * *** * * * *** **** ** *** * *
* ** *** * * * * ** * * **** ** *** * * * * ** **** * ** * * * ****
* *** * * **** ** * * ******* * ** ** ** * ** * *** **** ** * * ** * *
** * ** ** * * *** * * * * ** *** **** ** *
    }
*** * * * * ** * * *** * ** ** *** %d %d\n",max,min,arr[size]);
* * ***** **** ** *** *** 0;
}
trả lời bởi (196 điểm)
đã sửa bởi
0 0
Case 0: Wrong output
0 0
prog.c: In function 'main':
prog.c:9:16: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'char *' [-Wformat=]
        scanf("%d",&arr[i]);
                ^
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:108.162.216.108
©2016-2025

Những câu hỏi liên quan

2 thích 0 k thích
5 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38942 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 2.4k đã xem
2 thích 0 k thích
18 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38941 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 6.5k đã xem
3 thích 0 k thích
16 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38939 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 7k đã xem
3 thích 0 k thích
12 trả lời
[Exam] đã hỏi ngày 23 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38938 - Xem được từ: 2017-12-23 09:00 - Hiệu lực đến: 2017-12-23 12:10
| 4.9k đã xem
2 thích 0 k thích
3 trả lời
[Normal] Coding (C) - đã hỏi ngày 20 tháng 12 năm 2017 trong 2017-1 程式設計(一)AD bởi 楊修俊 (30k điểm)
ID: 38168 - Xem được từ: Không giới hạn - Hiệu lực đến: Không giới hạn
| 1.5k đã xem
12,783 câu hỏi
183,442 trả lời
172,219 bình luận
4,824 thành viên