Advertisement
Guest User

Untitled

a guest
Jan 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. /* Assignment: 5
  2. Campus: Ashdod
  3. Author: Benyamin Yakobi, ID: 323492835
  4. */
  5. #define _CRT_SECURE_NO_WARNINGS
  6. #include<stdio.h>
  7. #include<stdlib.h>
  8. struct date
  9. {
  10. int day, month, year;
  11. }typedef date_t;
  12.  
  13. struct lecturer
  14. {
  15. char *name;
  16. struct date birthdate;
  17. int num_of_courses;
  18. char **courses;
  19. }typedef lec_t;
  20.  
  21. Course_Lecturers();
  22. Common();
  23. Old();
  24.  
  25. void main() {
  26. lec_t l;
  27. int numoflecturers, i, j;
  28. printf("Enter number of lecturers: ");
  29. scanf("%d", &numoflecturers);
  30. for (i = 0; i < numoflecturers; i++)
  31. {
  32. printf("#%d - Enter name: ", i+1);
  33. l.name = (lec_t*)calloc(20, sizeof(lec_t));
  34. scanf("%s", l.name);
  35. printf("#%d - Enter number of courses for %s: ", i + 1, l.name);
  36. scanf("%d", &l.num_of_courses);
  37. for (j = 0; j < l.num_of_courses; j++)
  38. {
  39. l.courses = (lec_t**)calloc(20, sizeof(lec_t*));
  40. printf("Enter name of course: ");
  41. scanf("%s", *(l.courses+j));
  42. }
  43. printf("#%d - Enter lecturer Birthday\n", i+1);
  44. printf("Day: ");
  45. scanf("%d", &l.birthdate.day);
  46. printf("Month: ");
  47. scanf("%d", &l.birthdate.month);
  48. printf("Year: ");
  49. scanf("%d", &l.birthdate.year);
  50. }
  51. printf("%s", l.num_of_courses);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement