Advertisement
Guest User

Untitled

a guest
May 3rd, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.65 KB | None | 0 0
  1. for (int i = (int)stat.items_float.size(); i > 1; i--) {
  2.                 tag::statistics::statistics_item_float pair1 = stat.items_float[i];
  3.                 tag::statistics::statistics_item_float pair2 = stat.items_float[i-1];
  4.                 if (pair1.value != 0) {
  5.                     if (pair1.time > begin_day && pair2.time <= begin_day) {
  6.                         res_day = res_month + pair1.value * (pair1.time - begin_day);
  7.                     } else if (pair1.time > begin_week && pair2.time <= begin_week) {
  8.                         res_week = res_month + pair1.value * (pair1.time - begin_week);
  9.                     } else if (pair2.time > begin_month && pair2.time <= begin_month) {
  10.                         res_month += pair1.value * (pair1.time - begin_month);
  11.                         break;
  12.                     }
  13.                     res_month += pair1.value * (pair1.time - pair2.time);
  14.                 } else {
  15.                     if (pair1.time > begin_day && pair2.time <= begin_day) {
  16.                         res_day = res_month;
  17.                     } else if (pair1.time > begin_week && pair2.time <= begin_week) {
  18.                         res_week = res_month;
  19.                     } else if (pair2.time > begin_month && pair2.time <= begin_month) {
  20.                         break;
  21.                     }
  22.                 }
  23.             }
  24.             if (begin_day == begin_week && begin_day == begin_week) {
  25.                 res_month = res_week = res_day;
  26.             } else if (begin_day == begin_week) {
  27.                 res_week = res_day;
  28.             } else if (begin_week == begin_month) {
  29.                 res_month = res_week;
  30.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement