//This is the lecture example of the program described at the beginning of //chapter 9. //Read in some number of salaries then output them one per line marking the //highest salary as we are outputting them. #include #include using namespace std; //change this only to use for different number of salaries const int NUM_SALARIES = 10; int main() { //declare vector with number of salaries up front vector salaries(NUM_SALARIES); //stores largest salary double max = 0; cout << "Enter " << NUM_SALARIES << " salaries: \n"; //bring in each salary to vector and find largest for (int i = 0; i < salaries.size(); i++) { cin >> salaries[i]; //store in max largest salary found so far if (salaries[i] > max) { max = salaries[i]; } } //output all salaries as well as marking which is largest cout << endl; for (int i = 0; i < salaries.size(); i++) { //only output this line if this salary is largest if (salaries[i] == max) { cout << "Highest value => "; } cout << salaries[i] << endl; } return 0; }