You noted one temperature for each day of a week away. Write hottest(temps) to return the highest one. There is at least one day, and temperatures can be below zero.
hottest({21, 25, 19})→25hottest({18, 18, 22, 20})→22int hottest(const vector<int> &temps)#include <vector>
using namespace std;
int hottest(const vector<int> &temps) {
int best = temps[0];
for (int t : temps) {
// your code here: if t is higher than best, make best t
}
return best;
}
Run tries the examples. When they look right, Submit.