Category : oop

which is the best way to input the parameters? and then to display them together with "sum". The condition was to use virtual functions / abstract classes. #include <iostream> using namespace std; class progression { protected: double a0; double r; virtual void sum(int) = 0; }; class ARITHprogression: public progression { double g_suma(int n) { ..

Read more

In my application I have two classes a course class and a category class. The course class has a vector containing categories. using namespace std; class Course { private: string courseName; double courseGrade, totalCategoryWeight; vector<Category> categories; public: //These are the two funcs in my Course class not working as expected void addCategory(); vector<Category> getCategoriesVector(); }; ..

Read more

I am trying to return all the contests that have a value bigger than 30 for catfish but in my case it returns only the first one. I have this in my main.cpp bool second_search(const string &name, string &id) { Angler elem; AnglerEnor t(name); bool l = false; for(t.first(); !l && !t.end(); t.next()){ l = ..

Read more

Here is what I’m trying to do. class Parent{ private: int a; }; class Child:public parent{ private: int b; }; class outsideWorld{ private: vector<Parent> myvec; //note vector of type parent class. public: void myfunc(){ Child obj; obj.b = 30; myvec.push_back(obj); } void display(){ //help needed here //trying to display elements of child class from myvec ..

Read more

After learning some c++ stuff, I started to do some simple projects. In one of my function I have a problem, but I can’t figure out what that is. It should modify book records in a text file… and I think I have written everything correct, it should work… And after 3 hours of trying ..

Read more