I have a question it seems easy but i can not solve it Array of n integers is given. Find the two biggest elements in array. I found the first one can not find second one. Please help me to find the second one.
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for(int i=0;i<n;i++) {
cin>>a[i];
}
int maks=a[0];
for (int i=1;i<n;i++) {
if(a[i]>maks) {
maks=a[i];
}
}
cout << maks;
}