Here you are:
#include <iostream>
#include <list>
#include <functional>
bool check(int const lhs, int const rhs) {
return lhs < rhs;
}
int main() {
int pg;
std::cout << "What is the passing grade?\n";
std::cin >> pg;
std::list<int> grades{
70, 90, 79, 85, 96, 73, 99, 91, 81, 83,
99, 94, 80, 79, 85, 83, 82, 90, 84, 82,
72, 83, 76, 93, 90, 77, 82, 76, 100, 94
};
grades.remove_if(std::bind(check, std::placeholders::_1, pg));
for (auto const g : grades) {
std::cout << g << '\t';
}
return 0;
}
The function check has to return true when asked whether to remove the particular element which it was called with. Since remove_if requires unary predicate (function that can be called with 1 argument only) I used std::bind to generate new callable which when called passes the arguments std::placeholders::_1 and pg to check where instead of std::placeholders::_1 a copy of an element from grades is used.
Let's play this with pg = 90.
check(70, 90) -> Is 70 < 90 ? -> yes -> remove
check(90, 90) -> Is 90 < 90 ? -> no -> keep
check(79, 90) -> Is 79 < 90 ? -> yes -> remove
check(85, 90) -> Is 85 < 90 ? -> yes -> remove
check(96, 90) -> Is 96 < 90 ? -> no -> keep
I think you got the point.