So basically i need to replace the two largest elements of an array, inputed by user. I don't understand why doesn't my code working.
#include <iostream>
using namespace std;
double Max (double a[], int n) {
double max1=0, max2=0;
for (int i=0; i<n; i++){
if(max1 < a[i]){
max2 = max1;
max1 =a[i];}
else
if(max2 < a[i]){
max2 = a[i];}
}
return max2,max1;
}
int main () {
setlocale(0,".1251");
double a[7];
cout<<"Input 7-digit array:\n";
for (int i=0; i<7; i++) cin >> a[i];
for (int i=0; i<7; i++) {
cout<<a[i]<<"\t";
}
system ("pause>>void");
return 0;
}