mardi 6 octobre 2020

no member named 'stoi'

I already posted here but wanted to make a more clarified post, so i have my diplay function that displays linked list when the variable CurrentCapacity equals variable MaxCapacity in struct CourseData:

class CourseNode {
    private:
        CourseData elem;
        //
        CourseNode* next;

    public:
        CourseNode(CourseData elem) : elem(elem)
        {}  
        friend class Courses ;

};

class Courses {
    private:
        
        CourseNode *head;
    public:     
        Courses();
        ~Courses();
        void getCources();
        void addCoursesdata();
        bool empty() const;
        void removeFront();
        void addFront(const CourseData& elem);
        void loadData();
        void display() const;
        void viewFreeCourses() const;
        


struct CourseData {
    string CourseID, MaxCapacity, CurrentCapacity ;
    string CourseName, InstructorName, CourseSection, CourseLocation, ListOfStudents;
};

ostream& operator<<(ostream &os, const CourseData &data) {
    os << "("<<data.CourseName << ")";  
    return os;
}



void Courses::viewFreeCourses() const

{
    CourseNode *ptr=head;
    CourseData a;

    //cout<<"Head->";
    while(ptr!=NULL)
    {   
        if (ptr->stoi(elem.CurrentCapacity)==stoi(ptr->elem.MaxCapacity)) {
        cout<<ptr->elem<<endl; //"->";
        ptr=ptr->next;
    }
    }
    //cout<<"Null"<<endl;
}

But it outputs no member named 'stoi' in 'CourseNode', what could be the issue? Thanks in advance

Aucun commentaire:

Enregistrer un commentaire