The error is quite clear. By the time you are trying to allocate an array:
Record *room = new Record[5];
a default constructor, i.e. Record::Record()
, must be implemented so that 5 instances of Record
can be created:
struct Record
{
...
Record() : average(0.0) { }
Record(int s[], double a) { ... }
};
Also note that dynamic allocation is something you want to avoid as much as possible in C++ (except the situations when you have really good reason for it). In this case it would be more reasonable to use an std::vector
instead:
std::vector<Record> records(5);