#include <iostream>
using namespace std;
struct adv_t{
 int show;
 int click;
 int charge;
};
class CCal{
public:
 int cal_sum(adv_t adv_t[], int arr_size, int adv_t::*field_ptr){
 int sum = 0;
 if (field_ptr != NULL){
 for (int i=0; i<arr_size; i++){
 sum += adv_t[i].*field_ptr;
 }
 }
 return sum;
 };
};
int main(int argc, char const *argv[])
{
 adv_t advs[5] = {
 {0, 0, 0},
 {1, 0, 0},
 {1, 1, 100},
 {1, 1, 200},
 {0, 0, 0}
 };
 CCal* cCal = new CCal();
 cout << cCal->cal_sum(advs, sizeof(advs)/sizeof(adv_t), &adv_t::show) << endl;
 cout << cCal->cal_sum(advs, sizeof(advs)/sizeof(adv_t), &adv_t::click) << endl;
 cout << cCal->cal_sum(advs, sizeof(advs)/sizeof(adv_t), &adv_t::charge) << endl;
 return 0;
}