Advertisement
Guest User

log_medication

a guest
Mar 26th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. /*
  2. This function stores whether the medicine has been taken on time, late, or not at all. If the current week is full, it is stored in the memory so that it can be reviewed later
  3. */
  4.  
  5.  
  6. // day of the week is 1 if meds are taken on time, 2 if late, 0 if not.
  7. int day_of_week = 0; // Sunday = 0, Monday = 1, … Saturday = 6
  8. int current_week [7];
  9. int previous_week [7];
  10.  
  11. void log_medication (int status) { // status is 1 if taken on time, 2 if late, 0 if not
  12.  
  13. ++day_of_week;
  14. if (day_of_week > 6) {
  15.     //store current week in memory, then clear
  16.     for (int i = 0; i < 7; i++){
  17.         previous_week[i] = current_week[i];
  18.         current_week[i] = 0;
  19.         }
  20.     day_of_week = 0;}
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement