0 喜歡 0 不喜歡
6.8k 瀏覽

 

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.

Finish the code below to match the input and output. Pointer are 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)
		//No numbers were entered.
	else if (n == 1)
		//Only one number was entered. Largest: 
	else
		//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) - 最新提問 分類:C |
ID: 22313 - 從幾時開始: 無限制 - 到幾時結束: 無限制
1 舉報
修改於 用戶: | 6.8k 瀏覽
0 0
Called for Help

87 個回答

0 喜歡 0 不喜歡
內容已隱藏
#include * ** *** **



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

{
* * * * *** * * ** * ** i;
* * * ***** * *** ** *largest=a[0], * * * **** ** i<n; i++){
** * * ** ** ** *** * * ** ** * * ** *** *** *** * ** * ** * ********** ******
***** ***** ** * ** * * ** * * * ** * *** ***** * **** * ** **** * **** * ** * *** * *** *
* ** *** ** * * * **
* **** ***** * * ******* *** *** * i<n; i++){
** * * ** * * * * ** ** * ***** * * * * * * ** * ** * * * * ** * ** * **************
** *** *** * *

}



int main(void)

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


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


**** * * * * * *** (n == 0) * * ** * numbers were ** * *
****** * ** ** * * **** ** * **** numbers were entered.
* * ***** * * *** * * ***** if (n == 1) *** * ** * one number was entered. Largest: * ** * *
*** * * ** *** ** ** * ** ****** * * * * ** * one number was entered. Largest:
*** *** * * * * * ******** * *** %d, Second Largest: * *** **** ** *** ** *
* * * *** * * ****** **** * **** *** **** , Second Largest:


*** * ** * * * *** ** * 0;

}
最新回答 用戶: (-368 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * ** **



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



int main(void)

{
*** * *** ** *** * ** ** * n, largest, second_largest;
* ** ** **** ** ** ** ** * * * ** &n);
* *** **** * ** * ** a[n];
*** *** * * * * ***** (int i = 0; i < n; i++)
*** * * ** ** ** * ** ** ** ***** ****** ** * * %d", &a[i]);
* ** **** * * *** *** * **** n, &largest, *** **** ******


* * * ** *** ** * (n == 0)
* ** ** ** * * * * * * * *** * * ** ** *** * * * ** numbers were entered");
* ** * * *** **** * if (n == 1)
** *** * **** * *** * *** * ** * * ** * *** ****** * * one number was entered. Largest: %d",a[0]);
***** ** * **** * * *
**** **** *** * *** *** * * *** * * ***** ** * * ****** * %d, Second Largest: *** ** ** *** *** **


*** * ** ** * *** * 0;

}



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

{
****** * * ** *** *** i,max1=0,max2=0;
******* * *** * * * **** * *** * ** *
** * * ** *** * *
** ** ** * * ** * * ** ** * * ** ***** **
* * ** * * ** **** * ** * ** * * * ** *
* *** ***** ** ***** ** * ** ***** * * ***** * * * * * * ** * * * *
*** ** * *** ** * ** ** *** * ** **** * *** * *
* ** * ** **** *
*** ** * * ** * * * ** ** *** **
***** ** * * * ** *
*** * * **** * * * * *** ****** ***** * **** && a[i]<max1)
* ** * * * **** * *** ****** ***** ****
* **** * **** ** * ** * * * ** ****** ** ** * *** * ** ****** ***** ** **
* * * * * ** ** * * * ** * * * * * *
** * ** * * * **********
*** ** * * * ***** * *** *** *
* * *** * ******** ***** *** ** * * * * ***

}
最新回答 用戶: (-368 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * * *** * ** **



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],i;
* *** ** **** ****** * * * n integers separated by spaces
** **** ** ** *** ** *** (i = 0; i < n; i++)
** * ***** ** ** *** * * * * ** ***** * %d", &a[i]);


** * ** * *** * * * * ** * n, &largest, * *** *


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


*** ** *** *** * ** * 0;

}



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

{
*** ** * ** **** * * ** * Your code here (Using pointer to finish)
** ************* * * * * i, b;
* ** *** * **** ** ** * **
*** ** *** * * * * * * * * *
**** *** * ** *** * ** * i<n; i++)
***** * *** * *** ** ***
* * * ** * **** * *** * ***** **** * ** * ** **
**** * * *** *** ** **** * ** ****
* *** ** * * **** * * * ** **** * * **** * * **** * * * ** *
* * * * ** ** ** ** * * * * * *** *** * *** ** ** *** ** ** * = i;
***** *** * ** ** ** ***** ** * **** * *** * * *
* * * ** ** ** **
* ** * **** *** **** i<n; i++)
* * ** *** **** * ****
* * *** ******* * *** ** ** ** * *** * * * * ** * && i!=b)
**** * * ** ** ** *** ** * * **** * *
* **** * * ********** *** * * * * * * *** ** *** ** * * * * * *** * * ** *
** ***** * * * ** ** **** *******
* ** * ****** * * *** ** *

}
最新回答 用戶: (-368 分)
0 喜歡 0 不喜歡
內容已隱藏
#include *** ** **** ****



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



int main(void)

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


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


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


* * ***** ******* ****** * 0;

}



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

{
* ** ******* * * i, j = 0;
***** ** ** ********* *** ** * = a[0];
** **** * * * * * ** = 0; i < n; i++)
* **** * ** ** * * *
* * * * ** * * **** * * * * **** * * < a[i])
* ** ** * * * * * * ** * ** * * ** * * *
** **** * * * * ******** ** * ** ** * *** * *** ** ** *** * = a[i];
** * ** *** * * * * * * * * * * * * * * *** * = i;
** *** * * *** * * ** ** * ** **** ***
**** * * * * ** **


**** * **** ******* * * = a[0];
* ** **** ****** ***** = 0; i < n; i++)
**** ****** ** * *** * *
* * *** * *** **** * * * * * ** ** * * * * > *second_largest * **** *** i != j)
* **** * * ** ** * * *** * * * * *
*** * ** ** **** ***** * * * ** * ********* * * * * * * * ***** = a[i];
** ** ** * *** ** * ** * * * *
** * * * ** ** ** *

}
最新回答 用戶: (-218 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * * * * *



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



int main(void)

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


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


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


* ** **** * ** ** ** * * 0;

}



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

{
* * * * * * ** ** i, j = 0;
** *** * *** ** *** = a[0];
** ** * * * * ****** **** * ** = 0; i < n; i++)
* * * * * ** ** * *
** * * * ** ** **** * ** * ** *** **** *** * < a[i])
***** * * * ****** * * * ****** * *
** * ** ** * * ** **** * **** * *** ** * * * * * ****** * ***** * *** * * = a[i];
* ** *** *** * * ** * * ** * * ****** ** **** ** *** = i;
*** ** *** * * * * ** * ****** **
* *** * * * * ** ** * * * *


* * * *** * ******* * *** * = a[0];
*** * ** ******** * * = 0; i < n; i++)
** * * ****
** ** ** * ** * * * ** ******* ***** * > *second_largest ***** * ** * ** i != j)
* * ******* ** ** ** * ** * *** * * **
** ** * * **** * ******** ** * * ****** *** *** *** * ** ** = a[i];
** * ** *** * *** * * ** * * ************* *
* * * * *** * **

}
最新回答 用戶: (20 分)
0 喜歡 0 不喜歡
內容已隱藏
#include ** *** ***



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



int main(void)

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


** ** * * * ** * * ** * n, &largest, ** ** ** * *


* * * * ** * * ** ** (n == 0)
* **** *** * * * ** ** ******* ** * * * * numbers were entered.
* ** **** ** * *** * * ** ***** * **** numbers were * *** * *


** *** *** ***** ** *** ** * ** ** * ** ** ** * if (n == 1)
* * ** * * ** * * * ** * * **** *** * * * * * **** *** * one number was entered. Largest:
*** * * *** *** * * * ** *** * * * ** * *** * ** ****** * * ** * ** * ****** one number was entered. Largest: %d", a[0]);


**** * * ********* *** ** * * * ** * ** * * ** ** **** ** * *
* * ** * * ***** *** ** *** * ** * * **** * * * ** ** * ** * *** ** * * ** * ** * * ****** * * , Second Largest:
* * * * ** * * * ** * *** ** ***** * ** ** * * * * ***** *** * * ** * ** * *** * *** * %d, Second Largest: %d", largest, second_largest);


* ** ** * * ** *** * **** **** *** * * * * * ** **** ***** * * ***** *** ** * * 0;

}



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

{
* ** * *** * ** * *** * Your code here (Using pointer to finish)
* * * * * * * *** * i, j, k;
** * ** * * * * ** * temp = 0;


* * * ***** *** = 0; k< n; k++)
* * **** ** * * * *** ** * ** *** ** * *** *** ** * * ***** * *** * ** * * *** *** a[k]);
* ***** ** ** * ** ** *** * * * **** * * **




***** * * **** * ** ** * *** = 0; i < n-1; i++){
**** * * * ****** *** * *** * ****** * * = 0; j < n-i-1; j++){
* ** * ***** *** ** **** * * *** * *** ** * ** * *** ** * > a[j+1]){
** * ** ** *** * * ** * *** ** * ** * ***** * * * ** * * ** **** * * ** * * ** ** *** * * ** ** ** *** %d %d %d\n",j, a[j], a[j+1]);
** ** ** * ** ** *** **** * ** ** ** **** *** *** **** *** * * ****** * * * * * = a[j];
* * ****** * ** * * * **** ** * * ** * * * ** * * ** ** ** * * * *** * * *** = a[j+1];
** * ** * * ** * ***** * *** ** ** * * * *** * ** ********** * ** = temp;
* * * * * *** ** * * **** ****** *** ** * ** * ** *** ** **
** * *** * * * * ** * ** **** * * * ***


*** ** ** * * ** * *** ** * ** * ***** ** * * = 0; k< n; k++)
*** *** ** ** ** *** *** *** * ***** * * *** * ** ** ** * * ** * * ** * ", a[k]);
** * * ** * ** * ** ******* * ****** ******* *** * ** ** *
* * * * ** * * *


* *** * * * * * * ** *** * ** * i < n; i++)
*** * *** * * * *** * **** * * * * * *** * * * * * * ", a[i]);*/


** *** * * ***** **** ** * * *** ** a[n-1]);


* * * ** * * ** * * ** ** = a[n-1];
* *** ** ** * * *** ** = a[n-2];

}
最新回答 用戶: (-188 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * ** * ***



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



int main(void)

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


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


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


* * ** * ** ** ** **** ** * * **** ** * ******* * * ** * * * ** * * * * *** * 0;

}



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

{
**** * ** ******* ** * * * * Your code here (Using pointer to finish)
* *** * **** * * ***** * i, j;
* ** * * ** ** temp = 0;
* * * ** ***** * **** * = 0; i < n; i++){
* * * * **** ****** * * * * *** * * * *** * * * = 0; j < n-i; j++){
* * ** * * *** * ** * * * ** * **** * *** ** *** *** *** * > a[j+1]){
* * * * **** * * ** ** ** **** * ** * ** ** * * ** * ** * ***** *** * ***** * * ** ** ** ** = a[j];
* * *** ** ** * * **** * **** * ** * **** * *** ** * * *** * * **** * * * ** * *** = a[j+1];
*** * ** ** **** * * **** * ** ** * ** * ** *** * ** * * **** ** * * * * *** * ** * * = temp;
*** * ** * * ** * ** ** **** * * *** **** * ** * ** *** ***
*** *** ** *** * **** ** * ** *****
* * ** * * *** * * **


* * * ***** * * ** ** i<n; i++)
** * * ** ****** *** * * * ** * **** ", a[i]);


* ** * * ** * ** *** * = a[n-1];
* ***** ** * **** * * * = a[n-2];

}
最新回答 用戶: (-188 分)
0 喜歡 0 不喜歡
內容已隱藏
#include *** * *** * * **



void * * * * 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, * * ** * ***
**** ** * * * ****
* ** * * ******* ***** * (n == 0)
* *** ** * ** * ** * **** *** * * * * **** numbers were entered.
**** *** ** * ** * ** * ** *** *** * *** * ** *** * * numbers were * ** * * **
* * **** * ** * *** ** ** ** * ** * ********* ** if (n == 1)
* * *** ********* * * ** * ****** **** * *** * * ** * * *** **** * one number was entered. Largest:
** **** ** * * ***** * * ******** *** * ***** * * *** *** ** * * *** * ** one number was entered. Largest: %d", a[0]);
*** * *** * **** * * ** * * ** *** ***** * *** * ******** ** * *
* * ** **** * * ** * * * ** **** * * * *** ** ** *** * ******** *** * , Second Largest:
***** **** ******* * *** * ** ** * *** ** *** **** ** *** ** * * * ** ** * * * * *** * * ****** * ** * %d, Second Largest: %d", largest, second_largest);
** * *** * **** * ** * * *** **** ** * * *** * * * ** * ****** ** *** * * * ** * **** * ** * 0;

}



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

{
**** * * *** * *** ** Your code here (Using pointer to finish)
**** * * ****** i, j;
* ** * ** * * ****** ** *** temp = 0;
* ** * * ** * * * * ** = 0; i < n; i++){
** * * * ** ** * ** ** *** ** **** **** * = 0; j > n-1; j++){
**** * ***** * * * * *** ****** ** * * * * * *** **** *** * > a[j+1]){
******* * * * * ** * *** * ** ** * *** * * ** * ***** ***** ** ** **** ******* *** = a[j];
***** ** **** ** * * * * ** *** *** ** * ** ** * ** ** ** ** *** * * **** ** ** * * = a[j+1];
** ****** ** * * * * *** * *** * *** * * ***** * ** ** * *** *** *** ** * * = temp;
* * *** ** **** * * **** ** ** *** ** * ** *** ***** ** *
* * ** * * * ** * ** * * * * * * ** * ** * *
* * * ** * **** *
* ** ***** ******
* ** * * ** *** *** * * = a[n-1];
***** * ** ** * * * **** = a[n-2];

}
最新回答 用戶: (-188 分)
0 喜歡 0 不喜歡
內容已隱藏
#include * * ** **



void * * ** 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, ***** *** ****
* ** * *** ** *** *** * *
** * * * * * * ** ** * (n == 0)
* ** * * ***** * * *** ****** * * ***** ** * ** numbers were entered.
* *** ****** * * * * * * **** ** * *** ** *** * ***** *** * numbers were * * ***
* ** * ** * **** * *** ** * **** ** ** * * if (n == 1)
** ** * * * *** * * ** ** ** ** * ** * * * * * * ** * * * one number was entered. Largest:
* * * * * *** * ***** * * ** * *** * ******** ****** * * ** **** ** ** ** * one number was entered. Largest: %d", largest);
** ** **** ***** * * * ** ****** **** * *** ***** ** * ** ** * ** *
* * *** * * *** * * ** *** * * **** * *** * * * * ** *** *** ** ** *** * * * * , Second Largest:
* *** ** ** *** * * * * * ** * * * * ** *** *** **** ** * ** ** ** * ***** *** * * * ** *** * * ** %d, Second Largest: %d", largest, second_largest);
* * * ** * * *** * * * * * * *** ******** * * * **** **** * * *** * *** ** * 0;

}



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

{
* **** *** ** ** *** * Your code here (Using pointer to finish)
*** * * ** * ** * ** ** ** i, j;
** ** * *** * * ** *** * * temp = 0;
* *** * **** * *** = 0; i < n; i++){
* *** * ** * * * * ** * * *** * * * * * **** = 0; j > n-1; j++){
** *** * * ** * * ***** * *** * *** * *** ** * * * * * ** > a[j+1]){
* **** * *** * *** * * ** ** *** * * *** ** *** * * * * * * * * ** * * * ******* * *** = a[j];
* **** * ** ** ***** ** * * *** * * ** * * * ** * * *** * * *** **** * ** ** * ** ** * = a[j+1];
** * * ***** * * * * *** ** * * *** ** * * * * ** ***** * * * * *** * ***** * ** *** * ** * = temp;
* * ** *** *** *** ** * * ** *** * ** * ** ** ** ****
* *** **** * ** * * * ** * *****
** * *** ** * *** ** ** *
* * **** *********** ******
** **** * * * * * ** = a[n-1];
* * * * ** * **** ** = a[n-2];

}
最新回答 用戶: (-188 分)
0 喜歡 0 不喜歡
內容已隱藏
#include ** ** * *



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



int main(void)

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


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


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


* ** *** ** * * ** *** * * 0;

}



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

{
* ***** * ** *** *** i, j = 0;
* * * * *** * ** * * = a[0];
*** * **** * ** * = 0; i < n; i++)
** * * * * * ***
* * ** ** * * *** * *** * * ** * **** ** < a[i])
* * * * ** * * *** * **** * * *** ***
** *** **** * * * * ********** * ** * * * * ****** ** **** ** ** *** * = a[i];
* ** ** *** *** * ****** ** *** * *** * * ** ** ** ******** = i;
** ** * ** ** * ** **** * **** ** ** ** **
*** ** * ** * * ** ***** *


* * * * ** * *** * *** ** * = a[0];
** **** * * ***** ***** ***** = 0; i < n; i++)
** * * ***** * ** ** *
*** * *** * ******* * ***** * ** * ***** *** > *second_largest * ***** i != j)
* * * * * **** ***** * * * * ** * *
**** * **** **** * * * * * * * * * ** ****** * * *** * * ** * *** = a[i];
* ******* ** * ** **** * * ** ** * * * * **
*** * * * *** * * * *

}
最新回答 用戶: (6 分)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.127.204
©2016-2025

相關問題

1 喜歡 0 不喜歡
58 回答
[練習] Coding (C) - 最新提問 3月 23, 2017 分類:C |
ID: 23261 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 5k 瀏覽
0 喜歡 0 不喜歡
1 回答
[練習] Coding (C) - 最新提問 4月 27, 2017 分類:C++ |
ID: 24390 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 667 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶