/* PrintResults() displays names, test scores, and differences between * the scores and the mean score. * * Receive: meanScore, a double, * names, a vector of strings, * scores, a vector of doubles * Output: each name in names, each score in scores * and the difference of each score and meanScore **********************************************************************/ #include // setprecision() void PrintResults(double meanScore, const vector & names, const vector & scores) { cout << "\nThe mean score is " << right << fixed << showpoint // format for test scores << setprecision(1) << meanScore // show mean score << " (ignoring max and min).\n" << endl; for (int i = 0; i < names.size(); i++) // for each index in sequence: cout << setw(20) << names[i] // display name, << noshowpos << setw(5) << scores[i] << "\t(" // score, and << showpos << setw(5) << scores[i] - meanScore // difference from mean << ')' << endl; }