- 3

solve this

include<iostream> using namespace std; int main () { int A[10], n, i, j, x; cout << "Enter size of array : "; cin >> n; cout << "Enter elements of array : "; for (i = 0; i < n; i++) cin >> A[i]; for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { if (A[i] < A[j]) { x = A[i]; A[i] = A[j]; A[j] = x; } } } cout << "Second largest number : " << A[1]; cout << "\nSecond smallest number : " << A[n - 2]; return 0; } what is array in this field and how to solve this prgramm

2nd Feb 2021, 4:50 PM
Job book
Job book - avatar
6 odpowiedzi
+ 5
Question unclear. What do you mean by "array in this field"? Also, how do you *solve* a program? Programs are meant to be written and run. Programs are not math problems which you *solve*. Also, from your profile I can see that you haven't even started the C++ course. How can you expect you'll understand that program?
2nd Feb 2021, 5:20 PM
XXX
XXX - avatar
0
Add only a "#" symbol in line 0
2nd Feb 2021, 5:26 PM
Atul [Inactive]
0
What do you mean by solve? It looks like a complete solution. Should it be extended? Or are you asking for its purpose? It sorts the array and prints the second largest and smallest number, which can be done by index after sorting. It will crash if n<2 or n>10 If that doesn't answer your question, please explain your request in more detail.
2nd Feb 2021, 5:28 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
bro i got this question fron friend he told me to help him thts why i post it here
2nd Feb 2021, 5:29 PM
Job book
Job book - avatar
0
yes iam noob hrre
2nd Feb 2021, 5:30 PM
Job book
Job book - avatar
0
Well if there is no comprehensible question there can be no clear answer. People here are willing to help, myself included, but it can only work if you describe the actual problem
2nd Feb 2021, 10:47 PM
Benjamin Jürgens
Benjamin Jürgens - avatar