Bowling night had several games, and scores holds each game's score; there is at least one. low_high hands back the lowest and highest through two references, low and high. Fill in the loop: anything lower replaces low, anything higher replaces high.
score_range({120, 98, 145, 110})→'98 ~ 145'score_range({77})→'77 ~ 77'string score_range(const vector<int> &scores)#include <string>
#include <vector>
using namespace std;
void low_high(const vector<int> &scores, int &low, int &high) {
low = scores[0];
high = scores[0];
for (int s : scores) {
// your code here: lower replaces low, higher replaces high
}
}
string score_range(const vector<int> &scores) {
int low = 0, high = 0;
low_high(scores, low, high);
return to_string(low) + " ~ " + to_string(high);
}
Run tries the examples. When they look right, Submit.