Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Cześć.
  2. Przypomniałem sobie właśnie, że query_module ma rowniez wypisywac liczbe studentow uczeszczajacych na przedmiot.
  3. Przesylam kod funkcji liczącej to:
  4.  
  5. /**
  6. * Returns number of student attending to given module.
  7. */
  8. int students_to_module(char *mod_name) {
  9. int res = 0;
  10. scheme_node *tmp_sch = SCH_LIST->next;
  11.  
  12. while (tmp_sch != NULL) {
  13. if (mod_search(mod_name, tmp_sch->scheme.modules) != NULL) {
  14. // searched module hooked to tmp_sch
  15. res += tmp_sch->scheme.students;
  16. }
  17. tmp_sch = tmp_sch->next;
  18. }
  19. return res;
  20. }
  21.  
  22. Wystarczy w query_module wypisac wynik tej funkcji.
  23.  
  24. Pozdrawiam
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement