Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Assignment: 5
- Campus: Ashdod
- Author: Benyamin Yakobi, ID: 323492835
- */
- #define _CRT_SECURE_NO_WARNINGS
- #include<stdio.h>
- #include<stdlib.h>
- struct date
- {
- int day, month, year;
- }typedef date_t;
- struct lecturer
- {
- char *name;
- struct date birthdate;
- int num_of_courses;
- char **courses;
- }typedef lec_t;
- Course_Lecturers();
- Common();
- Old();
- void main() {
- lec_t l;
- int numoflecturers, i, j;
- printf("Enter number of lecturers: ");
- scanf("%d", &numoflecturers);
- for (i = 0; i < numoflecturers; i++)
- {
- printf("#%d - Enter name: ", i+1);
- l.name = (lec_t*)calloc(20, sizeof(lec_t));
- scanf("%s", l.name);
- printf("#%d - Enter number of courses for %s: ", i + 1, l.name);
- scanf("%d", &l.num_of_courses);
- for (j = 0; j < l.num_of_courses; j++)
- {
- l.courses = (lec_t**)calloc(20, sizeof(lec_t*));
- printf("Enter name of course: ");
- scanf("%s", *(l.courses+j));
- }
- printf("#%d - Enter lecturer Birthday\n", i+1);
- printf("Day: ");
- scanf("%d", &l.birthdate.day);
- printf("Month: ");
- scanf("%d", &l.birthdate.month);
- printf("Year: ");
- scanf("%d", &l.birthdate.year);
- }
- printf("%s", l.num_of_courses);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement