0 喜歡 0 不喜歡
17.8k 瀏覽

We will use this function to proceed and store the result 

void find_two_largest(int a[], int n, int *largest, int *second_largest);

* When passed an array a of length n, the function will search a for its largest and second-largest elements, storing them in the variables pointed to by largest and second_largest respectively.

寫 find_two_largest() 函數。陣列做為函數參數 找出最大值跟第二大值。

Finish the code below to match the input and output. Pointer is required. 請使用指標。

#include <stdio.h>

void find_two_largest(int a[], int n, int *largest, int *second_largest);

int main(void)
{
	int n, largest, second_largest;
	scanf("%d", &n); //Numbers will be entered
	int a[n];
    //Enter n integers separated by spaces
	for (int i = 0; i < n; i++)
		scanf(" %d", &a[i]);

	find_two_largest(a, n, &largest, &second_largest);

	if (n == 0)
		// Your code here
		//Print No numbers were entered.
	else if (n == 1)
		// Your code here
		//Print Only one number was entered. Largest: 
	else
		// Your code here
		//Print Largest: , Second Largest:

	return 0;
}

void find_two_largest(int a[], int n, int *largest, int *second_largest)
{
	// Your code here (Using pointer to finish)
}

Example input:

0

Example output:

No numbers were entered.

Example input:

1
67

Example output:

Only one number was entered. Largest: 67

Example input:

5
5 6 7 8 9

Example output:

Largest: 9, Second Largest: 8

 

[練習] Coding (C) - 最新提問 分類:Chapter 12: Pointers and Arrays |
ID: 38251 - 從幾時開始: 無限制 - 到幾時結束: 無限制

修改於 用戶: | 17.8k 瀏覽

58 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

void find_two_largest(int a[], int n, int *largest, int *second_largest);

int main(void)
{

** ****** ** * * * * * n, largest, second_largest;
* ** * * ** * ** * * *** *** ** &n); //Numbers will be entered
* * *** * **** * * * a[n];
****** * ** *** ** n integers separated by spaces
** * * ***** *** ** * ** *** (int i = 0; i < n; i++)
* * ******* * ** **** * ** * * *** ** * * * *** %d", &a[i]);

* ** * * **** ** * *** ** n, &largest, &second_largest);

* **** ***** ** * * ** * (n == 0)
** * * ** ** ** **** * * **** * * * ** ** ** numbers were entered.");
* * ** ** ** * *** ** ** **** * * * ** ** * *** No numbers were entered.
*** * *** * *** if (n == 1)
******* *** * *** * * * * * * **** ** * * ***** ** ****** one number was entered. Largest: %d",largest);
** **** *** * ** * *** ** * **** *** ** * ** Only one number was entered. Largest:
** * * ** * * ** * *
* *** * ** * ** **** *** * * ** ***** **** * ** * *** %d, Second Largest: %d",largest,second_largest);
* ** * * ** * * ** ** * * * * ** * Largest: , Second Largest:

** * ******* * ** *** 0;
}

void find_two_largest(int a[], int n, int *largest, int *second_largest)
{
* *** ** * * ***** * **** fir,sec;
** ** * *** **** *** i;
** **** * ** * **** *** ** ( n == 1 ) {
* * * * * ** ***** * *** * * * * *** * *** = a[0] ;
*** ** ** ** *** * * ***** * ***** * ;
** * * ** *** * * *
* * * * *** * * * * * *** ** * * * *
* * * * * ** *** **
***** * * ****** ************* ** * * * * * *
* * ** **** * ** * * **** * ** * * * ** *** * *
* *** ** ** *** * * * * * * **** ** * *** * * ** ** * s=%d\n",fir,sec);
    }
** ** ** **** * * * * ** **
* ** * * ** *
** ** * **** * ** * * * * * * ***** *** *
** **** * * *** *** * **** ** * * * ***** * ** * *
** ** ** *** *** ***** * ** ** * * ** *** *** *** ** * s=%d\n",fir,sec);
* * * * **** ** *** **
* *** ** *** * * *** * * ** *
** * * ** * ** ***
* * ****** ** * * ** * *** ** * *** ***** * * ** ** ** *** *** *
** *** ***** * *** ** ** ** * ** *** ** *
* ** ** * ** * ***** * ** * * **** *
* ** * ** *** * * ** * ** ***** ** * ** * * * **** **** * * *** ** *
* **** * *** * ***** *** * * * * **** *** ** * ****** * * *** * *

** ******* ** * * ** *** * * * ** ** **** * * * * * * * * ** *** * ** **** * * * * * ** ***
*** ** **** * *** * **** ***** ** ** ** * *
***** *** * * ** ***** * *** ** ******** if(a[i]>sec)
* **** ** ** * ** ****** ** *** * *** * * ****** **
* * *** *** ** * * ** * *** * * ** * * ** **** * *** * *
**** *** * * ** ** ** * ** * **** * ** * ** * **** * **** * ** * * ** ** ** * * * *****
** ** **** * * * **** *** **** * * * * ** *
* * * *** * ** ** ***
* * *** ** * ** * ** ****
****** ** * * * * * * ** ** * * **

** ** ***** **** * *** *** * ** * * %d, Second Largest: %d\n",fir,sec);
}
最新回答 用戶: (-140 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
#include <stdio.h>

void find_two_largest(int a[], int n, int *largest, int *second_largest);

int main(void)
{
    
* ******* * **** n, largest, second_largest;
* ***** ***** *** * * ** * *** * ** &n); //Numbers will be entered
** * * **** ** a[n];
**** ** ** ** ** *** ** * * n integers separated by spaces
*** *** * * ** **** * ** * (int i = 0; i < n; i++)
* ********* * *** ** * * ** *** *** * * **** ***** * * * %d", &a[i]);

** ** ** ******** * ** ** ** n, &largest, &second_largest);

** * ** * * **** * * *** (n == 0)
* ***** * * * * ** * *** * ****** * ** ** * * numbers were entered.");
* * *** ** ** *** ** * ** **** **** * ** ** **** No numbers were entered.
* ** * * ****** ** if (n == 1)
*** ** * * * * * * ***** * * * ***** **** ** * ** ****** * one number was entered. Largest: %d",largest);
* **** * * *** * * ********** * ** Only one number was entered. Largest:
** * * * * * **** * **
* * ** *** * * * *** ** ** ** ** * ** *** * ** * * * * * ** %d, Second Largest: %d",largest,second_largest);
* * ** ** * * * * ** * ** ** * ** * *** * * **** ** Largest: , Second Largest:

* ** *** * * * * 0;
}

void find_two_largest(int a[], int n, int *largest, int *second_largest)
{
** ** ** * ** ** *** *** ** fir,sec;
** * * * ** * ** ** i;
* ** ** ** ********* *** * ( n == 1 ) {
* * * * * * * * * *** * ** * * * * **** * *** = a[0] ;
** **** * *** * * * ** ** ** **** * * *** * * ;
*** * ** * ** * *****
* * * * *** * *** ***** *
** * ** ** **************
*** * *** * *** ** ** ***** * * * *
* * ** ******** * * ** ** * * ** * * **** *
* * ** ** *** ** * ** * ******* * **** * * * * **** * * * * s=%d\n",fir,sec);
** ** **
* ** *** ****** * *
** *** * * *** * * * *** **
* * * *** ** * * **** * * * *** * * * * ** **
*** *** ** *** *** ** *** ** * * * ** ** *** **
* * * * * * * * * *** * * *** ** ** * * * * * * s=%d\n",fir,sec);
* * ** ***** ** **
**** * ** * ** * ** * **** **
*** *** * * * * **
*** * ** ** * * * * * ** * * * ** ** ** ** * * ** * ** *** ******
**** * **** * ** * * * ** ** * * *** * * * ** ** *
** ** * ******** * *** *** ** *** * *** *
***** *** * ***** * *** *** * ** **** * * * *** * * * ** ***** *** ***
* *** ** * ** * ** * * * *** * * * ** * ***** *** * **
** ** * * * **** * ***** * *** * ** * ** ** * * * * ** * ** * ** *
***** * * * ** * ** * **** * * * * * **** * * * ** ** **** * * * **** * *
***** **** * ** * *** * * *** ****** ** * * **
****** *** * *** * ******** ** * * ** *** if(a[i]>sec)
* ** *** * * ** * * ** *** *** *** ** ****
* * **** * * ****** *** * ** ***** ***** ** * ** * *** **
** *** ** *** **** ** ** ** ** *** * ** ** *** *** ** ***** * * ***** * **** ******* *
* ** * ** **** * ** ** * ** * * *** **     
* ***** ** * * *
* * * * ** ** *** *** ** * **
* * *** * **** * * ** * * ****
    
* * * ***** * * * * * **** ** * * %d, Second Largest: %d\n",fir,sec);
}
最新回答 用戶: (-167 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
*** * * *** ** ****

** ** * * a[], int n, int * int *** *

int ** *
{
** ** ** * int n, *** * * * * *
** ** * ** * * **** * *** * ** * * **** will be ***
*** * ** * *** * int **
** * ** * *** ** n ** * by **
* *** * *** for (int i = 0; i *** n; i++)
** **** * * * ** * * ** * *** * *** **

* ** * * * * * * n, *** *** ** ** ** * * *

****** ** if (n == 0)
* * * ** * * * ** ** *** * ** * were * ** ** ** *
* * ***** * else if (n == 1)
**** * **** * * * * ** * ** ** * *** one * **** was * * * * * * ***
*** *** ** else
* * *** *** * * * * ** ***** * * %d, ** *** * **** * ***
* * ** * * * 0;
}

** * ** **** a[], int n, int * ** ** int * * *
{
* ** *** * ** * // Your code here * ** to *
**** * ** i = 0; i * ** * n; i++)
***** * *** {
* *** ** * * * * * * *** *** j = i; j * n; j++)
* * * * * * {
* * * * ***** * **** * ** * ** **** * ****** ** ** ** ***
***** * * * * *** ** * * * * {
* * * *** * * ** ** * * * ** * *** ** **** int temp = *

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

* * * * * *** * * *** ** * * * * * ** ** * a[i] = *
*** *** * **** ** * *** ** * ** * * }
***** ** * ** * ** }
* * * * * ** }

* * ** * **** = *

** * *** * * *** * = *
}
最新回答 用戶: (-285 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
*** * * ** ** *

void * ** a[], int n, int * * ** ** int ** * * **

int ***
{
* * * *** * int n, largest, * * * ** i;
* * * *** * * * ** *** * * * ** * will be entered
* * * * *** int a[n];
* ***** * * * ** **** * n integers ** * by spaces
*** * * *** ** for (i = 0; i < n; i++)
* ** * * *** * * * *** * *** * * ****** ** * * ** *

**** * *** ** ****** * ** n, **** * * ** ** *** * * ******

* * * ** * if (n == 0)
* * ** ** *** * * * ** * * numbers were * ***** *
* * * * ** ** ** * //Print No numbers were * **
**** ** * *** else if (n == 1)
** ***** ** * * ** ** ** ********** one number was *** *** **** ** **** * *** ***
* * * * ** ** ** ** * //Print Only one number was ****
* * * **** ** else
** *** * * * * ** * * ** *** ** %d, Second *** * ** *** *** **
* * * * *** *** ** * //Print ** , Second * **

*** ** *** * return 0;
}

void ** * *** a[], int n, int * * int ** **
{
** ** * * * *** i;
* **** ***** * for(i = 0; i * * n; i++){
* * * *** ** ** ** * *** * ** * * * ** *** * *
***** * *** ****** *** * * * * * **** *** * * * * ** ** ** * ** ** = * ** *
* * * *** * * * * **** * * ******* * * * * * * * * * ** * = a[i];
** * ** * ***** **** * * * * **** ** * else if (a[i] * * * ** *
* * ** * ****** * * ** *** * ** * * ** * * * ** * * * ** * * * ** * ** a[i] * *
*** ***** *** * * * ******** * * ****** ** * * ****** ** * * **** ** = a[i];
*** *** * * ** * ** * *** * **** **** ** *** *
** ** ***** *** ***** *
}
最新回答 用戶: (-168 分)
0 0
prog.c: In function 'find_two_largest':
prog.c:33:17: warning: comparison between pointer and integer
         if(a[i] > largest){
                 ^
prog.c:35:21: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
             largest = a[i];
                     ^
prog.c:36:25: warning: comparison between pointer and integer
         } else if (a[i] > second_largest
                         ^
prog.c:37:21: warning: comparison between pointer and integer
             && a[i] < largest){
                     ^
prog.c:38:28: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
             second_largest = a[i];
                            ^
0 喜歡 0 不喜歡
內容已隱藏
#include **** *** * *
#include ** ** * * **


void * *** *** a[], int n, int *largest, int *** *

int * *
{
** *** * * * int n, largest, *
* * ** * * * * * * **** * ** ** * *
** * * * * **** int a[n];
* ** ** * * * * int i;

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

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

**** *** * if (n == 0)
* **** * * * * * ** * * ** ** *** * * **** * * ** numbers were * *** ***

* * ** else if (n == 1)
* **** **** * *** * ** * * one number was entered. Largest: ** * ***

**** * * * else
** ** * ** ** * *** * %d, Second Largest: * ** ** * **

** ** * *** return 0;
}

void * * ** a[], int n, int *largest, int *** **** *
{
* * ** **** int i;
** * ** *** ** *** ****

** *** * ** * *** **
* * * * * ** **** **
** * *** * * * * *** ***** * **** * ** * * ***
*** * * ***** * ** * * *** * ** * * * *
* * ** ** * * **** *** ** * ** * *** *** *** ** * ** **
* * ** *** * * * *
}
最新回答 用戶: (-16 分)
修改於 用戶:
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
* * ** ** **

void * **** * ** a[], int n, int * * int * * ***

int *** *
{
****** * ** int i,n, * **** ******** * *
* ** *** * * * * ** ** ** *** ** * * will be entered
* * * int a[n];
* * * *** * ******* n ** * * * * * by spaces
**** ** ** * *** for *** *** * * *
*** ** * * * ** * ** * ****** *** *** *

* * *** * * ** * * n, * ** * ** * * ** **** *

*** **** if (n == 0)
* * * * ** ** * * * ** // Your code here
* * ** ** * ** *** //Print No numbers were * * *
*** * * * * *** * * * *** ** * ** ** numbers were **** ** ***
**** *** *** else if (n == 1)
* **** ** *** ** * * * * * // Your code here
* ***** * **** *** * //Print Only one number was * * * * *
* * * * *** ** ** * * ***** * *** one number was ** * * *** * * *
* **** *** else
* ** * ** * * ** ** * * // Your code here
* ** * * * * * ** //Print * * , Second **

* ** * * * *** * ** ** * *** ** * * ** * * * %d, Second * ** ** * *** ** * *

**** * * * return 0;
}

void ** * ** ** a[], int n, int * int **** ** **
{
** *** * * // Your code here (Using pointer to finish)
* * ** * * * int i;
* * ** *** ** * ** *
* **** * ** * * * * * ** *

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

}
最新回答 用戶: (-32 分)
修改於 用戶:
0 0
Case 0: Wrong output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
* * *** ***** ****


//void * * *** ** a[], int n, int ** * int ** *

int ** *** * largest, int **** *****
{
* *** * ** ** return (largest == *** *** *
}

void * * * ** * a[], int n, int* * int* *** **** ** *
{
* * * ** * int i;
* **** ** * int *** = a[0];
* ** * * **** for(i = 0; i *** n; i++)
* * *** *** ** {
** ****** ** * ** * * if (a[i] > * *
* * * ** ** ** * * ** *** * *** **
* *** * ** * *** ** * * * * * *** _largest = a[i];
** ** * * * * ** * * **** **
** ** ** }
* * ** = ***
** *** *
* * * ** ** * int * = a[0];
** ** *** ** * ** ** ** * ** = 0; i ** n; i++)
* ** * * ** * *** *
**** ** * *** ** *** ** * if (a[i] ** * * **** ** * * != a[i])
** **** *** ** *** ** * * ** * {
** **** * * ** ** *** *** **** * * * * ** * ** * * = a[i];
** * * *** ** * }
* * * ** }
*** ** * ** ** * * = *** **
}


int ****
{
* * ** * *** int n, * * * ** **
** ****** ** * ***** * ***** *** ** * * * * * * ** will be entered
******** * * * int a[n];
** * * *** ** * *** * * n ** * *** by spaces
* * ** * ** int i;
*** ** * * * * for (i = 0; i < n; i++)
* ** * * *** * ** ** **
****** * * *** * *** * * * ** ***** ***** ** * * * * * * *****
*** * * * ** ** * ****



**** *** ** **** * n, * * *** *** * * * ***
** ** * * ***** *
***** * ** * * ** * *** ** *** * * ** **** * * * n = 1;
*** **** * * * * ****
** ** ** if (n == 0)
* ** * * * *** ** ** * * {
* *** * * * ** * * ** ** * ** ** ***** ** *** ** * numbers were ** *
* ** * * * ** * * }
** ** * * * else if (n == 1)
* * * * *** * * {
* ****** * *** ** ** * *** * ** ** * **** * * * *** * ***** * one number was entered. ** ** ** * **
** * * **** * }
** *** ** else
** *** * * * ** * * {
*** ** * ** * * * * * ** * * ** *** ** * ***** * *** *** ** %d, Second ****** ** * * ** * * *
** ** ** ** ** * * }

* * *** ** * return 0;
}
最新回答 用戶: (-214 分)
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
** * * *


//void * ** * * ** a[], int n, int ** int * * ** * *


void ** * ** a[], int n, int* * **** int* ** **
{
*** int i;
*** ** * * int *** = a[0];
** ** * * * for(i = 0; i * ** n; i++)
***** * *** {
* * ** * * * * * * ** ** if (a[i] > * * *
**** * ***** * ** * * * * ** **** * **
* * ** * **** * **** ** * * * _largest = a[i];
* ***** ** * * * * * **** * ****
** * *** * * * }
*** * * * ** = **** *
* ** *
* * * ** ** * ** int * ** * = a[0];
* * ** *** ** ***** = 0; i < n; i++)
* * ** * * *** *
** *** ** * * * * ** **** *** *** * if (a[i] > * ** * * * * * != a[i])
**** * *** ** * * ** *** {
* ******* * * ** ** * * * * ** * * ** *** * = a[i];
* ** * * * * ** }
* **** * * * ** }
* * * ** = **
}


int **
{
** * * * * int n, ** ** *
** * ** ****** *** ** ** *** * **** * ** * * * *** will be entered
* ***** * int a[n];
* *** * ** * **** ** ** ** n ** ** by spaces
** **** * * ** int i;
**** ** * ** for (i = 0; i * n; i++)
**** * ***** *** * *** ***
*** * ** **** ** ** ** * * ** **** ** **** * * * ** * *** * **
* ***** *** *** * *



* * ** * * * *** n, ** ** * ** ** *** **

* ** * if (n == 0)
* * ** *** * * * * * ** {
**** ** * ** * * **** * * * * * *** ***** * * ** ** numbers were * * **** *
** * * * ** ** * * **** }
* ** * ****** else if (n == 1)
* ** * ** ****** * * ** {
* * ** ** **** * * * * **** ***** * * **** * * * *** one number was *** ***** * ** *
* ** * **** *** **** * }
** * ** ** else
* ** * *** * * * {
* * * * * * ** * * * * *** ****** * * *** ** ** ** ** ***** %d, Second ** * ** ********* * * * * *
** ** ** * * * **** * * * }

** *** * * return 0;
}
最新回答 用戶: (-214 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Wrong output
Case 3: Correct output
0 喜歡 0 不喜歡
內容已隱藏
* * * ** **


//void * **** * a[], int n, int * * int ** * * *


void ** * *** a[], int n, int* *** int* ** **
{
** *** * for(int i = 0; i < n; i++)
** * * *** if (a[i] > largest)
** * ** ** * ** * * **** *** * ** * **
* * ** ** ** * *** * ** * * * * * **** * * = a[i]; * ** * *
** ** * **** * ***** * ** ** ** * ** *
* *** ** ** ** * * * * *
** *** * *
}


int *** ** *
{
** * **** int n, * * * **
* * * ** ** * * * *** * *** * ******* * ** * * * * will be entered
** ** * * int a[n];
* * * * * **** ** *** * n integers ** by spaces
* * * for (int i = 0; i < n; i++)
**** ** ** * **
** * * *** *** * * ***** ** ** *** *** * * ** ** * **
* *** * ** * ** ** *****
*** **** * ** ** * ** **
* ** ** * * * *

***** ** ** * **** n, * * *** * * * * ***

** * * * ** * if (n == 0)
* * * * * * * * * {
*** * **** * * * * *** ** * * *** **** *** * * ** numbers were * * ****
* * **** ** * * * ** ** ** }
* ** * ***** else if (n == 1)
* * **** *** *** {
* *** * ** * * * *** * * *** * * ** * ** * ** * * ** one number was ** * ** * * * *** * *
* ** *** * ** * * * }
* ** ** * * else
* * ** **** * *** ** {
* * * * * * ** *** * * *** ** ** ******* *** * * * * * ** ** * %d, Second ** ** * * * * * *** * *
*** ** ** * * * * }

* ***** *** return 0;
}
最新回答 用戶: (-214 分)
0 0
prog.c: In function 'find_two_largest':
prog.c:10:11: warning: comparison between pointer and integer
  if (a[i] > largest)
           ^
prog.c:12:16: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
        largest = a[i];
                ^
prog.c: In function 'main':
prog.c:40:14: warning: missing terminating " character
       printf("Only one number was entered. Largest:%d,&largest);
              ^
prog.c:40:14: error: missing terminating " character
       printf("Only one number was entered. Largest:%d,&largest);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.c:41:3: error: expected expression before '}' token
   }
   ^
prog.c:41:3: error: expected ';' before '}' token
prog.c:44:14: warning: missing terminating " character
       printf("Largest: %d, Second Largest: %d,&largest, &second_largest);
              ^
prog.c:44:14: error: missing terminating " character
       printf("Largest: %d, Second Largest: %d,&largest, &second_largest);
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.c:45:3: error: expected expression before '}' token
   }
   ^
prog.c:45:3: error: expected ';' before '}' token
0 喜歡 0 不喜歡
內容已隱藏
#include * * *** ** * *
#include *** *******


void ** ** * a[], int n, int *largest, int * ****
{
* ** * ** **
* ** *** * *** if (n==0)
** * * * * {
** * * * ** * * * ** * * ** *** **** numbers were ** *** *
* ** ** * }
** ** * **** ** else if (n==1){
** * * * * ** ***
*** * * * *** * * * * ** * *** * *
* ** * * * * **** * ** * * * one number was entered. Largest: *** * * * **
* * * *** }
* * * else{
***** * ** ***** * ** int i, *** *** * * * *
* ** * *** ** * ** **
** * * * * * *** * *** * * * *** *
* * *** ** ** *** **** for (i=0; * ** i++)
* ** *** * * * *** * * {
** * * ** *** ******* * ** ** *** * ** * ** *
* * ** * * * *** ** * * **** ** * ***** * *
** * **** * * **** * **** * * * ** ** }
* * **** ** ***** * * ** * * }
** * *** * *** * * * ***** **
* *   * ** **** *** * * ***** %i, * *** *** *

* * ** * * ** * * * for (i=0; * *** ** i++){
** * * ** * ***** * *** ** *** * * * * * * * ** * *** * *** ***** *** * *
** ** * ** ** ** * *** * * ** * * * *** * ** * * * * **
** ** **** * * * ***** ** *** * ** * }
* ** *** * * **** * * }
** * ***** ** ** * * * * * * ** ***** * ** **
**** ** * * ** * * *** ** ** ****** * * ** ** * Largest: * *** *** * *****

* * *** }
}

void ** * * * a[], int n, int *largest, int * ** *

int ***
{


* * ** * int n, largest, * ***** *

* * ** * * * * * ** ***** * * ** *
** * ** ** int a[n];

***** * *** * for (int i = 0; i < n; i++)
** * * ** ** * ***** * * *** ** ** *******

**** * ** * * **** *** ** n, ** ** * * * **** * *


* * ** return 0;
}
最新回答 用戶: (-304 分)
修改於 用戶:
0 0
Case 0: Correct output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.243.108
©2016-2026

相關問題

0 喜歡 0 不喜歡
30 回答
[練習] Coding (C) - 最新提問 12月 21, 2017 分類:Chapter 11: Pointers |
ID: 38255 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 10.8k 瀏覽
0 喜歡 0 不喜歡
58 回答
[練習] Coding (C) - 最新提問 12月 21, 2017 分類:Chapter 12: Pointers and Arrays |
ID: 38252 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 15.3k 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶