The class Record contains the month, day, and balance. After creating the Record Object array, I would like to sort it by balance in ascending order and display them. Then, I would like to sort it by the date in ascending order and display them again. I was able to sort by balance, but cannot ..
Category : object
I am a computer engineering student and as part of an assignment I had to create a database of objects. The instructions for the assignment suggested that I build the database using an array of pointers to the objects which I did using a dynamically allocated array typedef employee* employeePtr; employeePtr* employees = new employeePtr[6]; ..
In this code, Payment is an abstract base class of Credit. Any idea how to fix this assignment? binary ‘=’: no operator found which takes a right-hand operand of type ‘Credit *’ (or there is no acceptable conversion) unique_ptr<Payment> p; Credit c("<cardnumber>", "<expdate>", 9999.99); p = &c; Source: Windows Que..
I have the problem with the polymorhpism and the linked list. I have one base class Employee where I have the node class and use it to create a linked list of objects. It works for the base class, but for the derived classes, what it outputs is just the output of the base class ..
I have a function which processes data that comes as a sequence. Because of this, I need to know the value of certain variables from the last function call during the current function call. My current approach to doing this is to use static variables. My function goes something like this: bool processData(Object message){ static ..
I am new to C++ and I had problems with running this small example of inputing number of rectangle that we want to calculate the area each every one of them. Here is my code: #include<iostream> #include<conio.h> using namespace std; class Rectangle{ private: float length; float width; public: void input() { cout<<"length:"<<endl; cin>>length; cout<<"width:"<<endl; cin>>width; ..
I’m very new and attempting to create a deck that will be filled at random from cardpool, permterm will also be filled with the same cards. This will give you duplicates of some cards and singles of others, as intended. Then you can use a card or draw a card and it will sort hand() ..
I wrote this code while learning virtual base class(I guess the problem is not realated to virtual base class) but I encountered a different problem. Here everything is okay except for the total variable created in the Result class. I tried to assign the value of (phy+math+sports) to the total variable in the setResult function ..
I try to create a list of objects and increase its size by 1 if necessary by deleting the old list and creating a new one larger, but it gives an warning and then it breaks Warning C6385 Reading invalid data from ‘new_pers’: the readable size is ‘(unsigned int)*28+4′ bytes, but ’56’ bytes may be ..
As I am practicing my C++, I was wondering if it is possible to store different values of two objects for static array within class. For example: We have a class with a two dimensional array 3×3 which is static float, then two objects are created and passed to fill my array. class Matrix{ public: ..
Recent Comments