dimanche 23 janvier 2022

given list of grades

This is the code I have made, however, what is being displayed is incorrect. Kindly teach me what do I need to fix.

#include <iostream>
#include <list>
using namespace std;

bool check(int passing){
    int g;
    if(g<=passing){
        return false;
    }else{
        return true;
    }
}

int main()
{
    int pg;

    cout<<"What is the passing grade?"<<endl;
    cin>>pg;

    list<int> grades = {100,90,93,95,92,98,97,99,96,94};
    grades.remove_if(check);
    for(int x : grades){
        cout<<x<<'\t';
    }
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire