I have a problem trying to retrieve info from 2 structs. The first is:
struct PhoneCall{
std::string date;
int minutes;
int seconds;
the second is :
struct Bill{
Customer holder;
Plan plan;
PhoneCall callList[BILL_CALL_LIST_SIZE];
int count;
long durationSeconds;
int block;
I have higlighted PhoneCall which has been created from the struct PhoneCall.
I need to solve the function
int GetTotalHours(Bill& bill)
Im finding it difficult to create pointer from bill to Phonecall . I get a message saying no conversion exists.
I have since attempted the following code which was kindly offered as a solution.( I had used something similar but it seems to return an address 001A11EF).
int total_hours = 0;
for (int call = 0; call < BILL_CALL_LIST_SIZE; ++call)
{
total_hours += bill.callList[call].minutes / 60+ bill.callList[call].seconds / 3600;
}
return total_hours;
There is another function later to return total minutes, which is why the function the GetTotalHours is an int type.
I am incredibly new to programming and have jumped in the deep end but hope you can help :)