Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void print_students(slist *head){
- clist * head_c;
- if(!head) {
- printf("STUDENT LIST: EMPTY!\n");
- return;
- }
- else{
- printf("STUDENT LIST:\n");
- while(head){
- printf("%d:%s\n",head->info->id,head->info->name);
- head_c=head->info->courses;
- if(!head_c)
- printf("student is not registered for courses.\n");
- else{
- printf("courses: ");
- while(head_c){
- printf("%d-%s",head_c->info->number,head_c->info->title);
- head_c=head_c->next;
- (!head_c?printf("\n"):printf(", "));
- }
- }
- head=head->next;
- }
- }
- }
- void print_courses(clist *head){
- slist * head_s;
- if(!head) {
- printf("COURSE LIST: EMPTY!\n");
- return;
- }
- else{
- printf("STUDENT LIST:\n");
- while(head){
- printf("%d:%s\n",head->info->number,head->info->title);
- head_s=head->info->students;
- if(!head_s)
- printf("course has no students.\n");
- else{
- printf("courses: ");
- while(head_s!=NULL){
- printf("%d-%s",head_s->info->id,head_s->info->name);
- head_s=head_s->next;
- (!head_s?printf("\n"):printf(", "));
- }
- }
- head=head->next;
- }
- }
- }
Add Comment
Please, Sign In to add comment