Yahoo Clever wird am 4. Mai 2021 (Eastern Time, Zeitzone US-Ostküste) eingestellt. Ab dem 20. April 2021 (Eastern Time) ist die Website von Yahoo Clever nur noch im reinen Lesemodus verfügbar. Andere Yahoo Produkte oder Dienste oder Ihr Yahoo Account sind von diesen Änderungen nicht betroffen. Auf dieser Hilfeseite finden Sie weitere Informationen zur Einstellung von Yahoo Clever und dazu, wie Sie Ihre Daten herunterladen.

link list c programming help?

I have sturcture which is given to me

typedef struct program* ProgramTypePtr;

typedef struct course* CourseTypePtr;

/* Structure definitions. */

typedef struct teachPeriod

{

char semester; /* 'y' or 'n' for each semester */

unsigned year; /* 2010 by default */

} TeachPeriodType;

typedef struct course

{

char courseID[COURSE_ID_LEN + 1]; /* Unique ID for a course */

char progID[PROG_ID_LEN + 1];

char courseTitle[MAX_TITLE_LEN + 1];

char courseCode[COURSE_CODE_LEN + 1];

unsigned creditPoints;

TeachPeriodType teachPeriods[NUM_TEACHPERIODS];

char courseDescription[MAX_DESC_LEN];

CourseTypePtr nextCourse;

} CourseType;

typedef struct program

{

char progID[PROG_ID_LEN + 1]; /* Unique ID for a program */

char progTitle[MAX_TITLE_LEN + 1];

char progMajor[MAX_TITLE_LEN + 1];

char progCode[PROG_CODE_LEN + 1];

float progDuration;

char progType[PROG_TYPE_LEN]; /* Undergrade(UG) or Postgrad (PG) */

char progMode[MODE_LEN]; /* Full-time (FT) or Part-time (PT) */

char progDescription[MAX_DESC_LEN];

char majorDescription[MAX_DESC_LEN];

ProgramTypePtr nextProgram;

CourseTypePtr headCourse;

unsigned numCourses;

} ProgramType;

typedef struct pms

{

ProgramTypePtr headProgram;

unsigned numPrograms;

} PMSType;

I just wana know how to add programs and add courses. Each program can have many courses.

2 Antworten

Relevanz
  • vor 1 Jahrzehnt
    Beste Antwort

    You use PMSType to store the list of all programs. When adding a program, you use the nextProgram field within program to manipulate the linked list or programs.

    For a given program, you use the headCourse type to store the list of courses for that program. When adding courses, you use the nextCourse field within course to manipulate the linked list of courses.

    You also have to keep the counts up to date: numPrograms and numCourses when you insert into the lists.

  • towle
    Lv 4
    vor 4 Jahren

    linked checklist is one in all the easy records systems, and can be used to enforce different records systems. It includes a chain of NODES, each containing records fields and one or 2 references ("links") pointing to the subsequent and/or previous nodes. examples are a million. Singly-linked checklist >> the simplest form of linked checklist is a singly-linked checklist (or slist for short), which has one link consistent with node. This link factors to the subsequent node interior the checklist, or to a null fee or empty checklist if it extremely is the suitable node. 2. Doubly-linked checklist >> A greater state-of-the-artwork form of linked checklist is a doubly-linked checklist or 2-way linked checklist. each node has 2 links: one factors to the previous node, or factors to a null fee or empty checklist if it extremely is the 1st node; and one factors to the subsequent, or factors to a null fee or empty checklist if it extremely is the suitable node. 3. Circularly-linked checklist >> In a circularly-linked checklist, the 1st and extremely final nodes are linked jointly

Haben Sie noch Fragen? Jetzt beantworten lassen.