ond one properly. I have tried several things (many of which are commented out) to get this to work, but the second highest one usually doesn't print the second highest one. Can someone figure out what I am missing?
Any help would be very appreciated.Code:#include <iostream> using namespace std; int main ( ) { int number; int highest; // int var = 0; int secondhighest = 0; int input; cout << "How many numbers? "; cin >> number; cin >> input; highest = input; secondhighest = input; for(int track = 1; track < number; track++) { cin >> input; // secondhighest = input; // if(second == 4) { // var = second; // } if(highest <= input) { secondhighest = highest; highest = input; } else if(input >= secondhighest) { input = secondhighest; // secondhighest = input; } // else if(secondhighest > input) { // } } cout << "Highest: " << highest << endl; cout << "Second: " << secondhighest; }