1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
# include <iostream>
using namespace std;
float prodlargest(float a, float b, float c){
float one, two;
one = a;
two = b;
if (b > one){
one = b;
two = a;
}
if (c > one){
two = one;
one = c;
} else if (c > two){
two = c;
}
return one * two;
}
int main () {
int inputArray1[5]={0,0,0,0,0};
int inputArray2[5]={0,0,0,0,0};
int inputArray3[5]={0,0,0,0,0};
cin >> inputArray1[5];
cin >> inputArray2[5];
cin >> inputArray3[5];
float ans1, ans2, ans3;
//The FOR loop will multiply the first two biggest integers in the array.
for (int i = 0; i < 5; i++) {
ans1 = prodlargest(inputArray1[i], inputArray2[i], inputArray3[i]);
cout << "The largest products are: " << ans1 << endl;
} //End Loop
return 0;
}
|