- 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
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?
0
Add only a "#" symbol in line 0
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.
0
bro i got this question fron friend he told me to help him thts why i post it here
0
yes iam noob hrre
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