4 喜歡 0 不喜歡
11.9k 瀏覽

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

 

輸入說明:

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

 

輸出說明:

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

 

輸入範例:

5
1 1 2 2 3

 

輸出範例

3 1 2
[考試] 最新提問 分類:2017-1 程式設計(一)AD | 用戶: (30k 分)
ID: 38940 - 從幾時開始: 2017-12-23 09:00 - 到幾時結束: 2017-12-23 12:10
| 11.9k 瀏覽

16 個回答

0 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (160 分)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
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;
    
}
最新回答 用戶: (174 分)
修改於 用戶:
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 喜歡 0 不喜歡
內容已隱藏
#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;
    
}
最新回答 用戶: (215 分)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (100 分)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (212 分)
0 0
Case 0: Wrong output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (190 分)
修改於 用戶:
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 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (131 分)
0 0
Case 0: Correct output
0 0
-----------Re-judge-----------
Case 0: Wrong output
0 喜歡 0 不喜歡
內容已隱藏
#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);
      
}
最新回答 用戶: (172 分)
修改於 用戶:
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 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (144 分)
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 喜歡 0 不喜歡
內容已隱藏
#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;
}
最新回答 用戶: (196 分)
修改於 用戶:
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:162.159.115.32
©2016-2026

相關問題

2 喜歡 0 不喜歡
5 回答
[考試] 最新提問 12月 23, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 38942 - 從幾時開始: 2017-12-23 09:00 - 到幾時結束: 2017-12-23 12:10
| 2.9k 瀏覽
2 喜歡 0 不喜歡
18 回答
[考試] 最新提問 12月 23, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 38941 - 從幾時開始: 2017-12-23 09:00 - 到幾時結束: 2017-12-23 12:10
| 7.6k 瀏覽
3 喜歡 0 不喜歡
16 回答
[考試] 最新提問 12月 23, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 38939 - 從幾時開始: 2017-12-23 09:00 - 到幾時結束: 2017-12-23 12:10
| 8.7k 瀏覽
3 喜歡 0 不喜歡
12 回答
[考試] 最新提問 12月 23, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 38938 - 從幾時開始: 2017-12-23 09:00 - 到幾時結束: 2017-12-23 12:10
| 6.1k 瀏覽
2 喜歡 0 不喜歡
3 回答
[正常] Coding (C) - 最新提問 12月 20, 2017 分類:2017-1 程式設計(一)AD | 用戶: 楊修俊 (30k 分)
ID: 38168 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 1.9k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶