Esempio n. 1
0
int main ( int arc, char *argv[] ) {
  /* example of setting requisites to test the basic display */
  /*  struct course * ptrCourse119 = findCourse( "CSC119"  );
   struct course * ptrCourse121 = findCourse( "CSC121"  );
   struct course * ptrCourse221 = findCourse( "CSC221"  );
   struct course * ptrCourse311 = findCourse( "CSC311"  );
   struct course * ptrCourse320 = findCourse( "CSC320"  );
   struct course * ptrCourse323 = findCourse( "CSC323"  );

   ptrCourse323->prerequisites[0] = ptrCourse320;

   ptrCourse320->prerequisites[0] = ptrCourse221;

   ptrCourse311->prerequisites[0] = ptrCourse221;

   ptrCourse221->prerequisites[0] = ptrCourse121;
   ptrCourse221->prerequisites[1] = ptrCourse119; */

  for ( int x = 0 ; strlen(courses[x].id) > 0 ; x++ ) {
    setRequisites( &courses[x] );
	  counterLevel=1;
	  RecprintCourse( &courses[x] );
  }
	/*
  for ( int x = 0 ; strlen(requisites[x].id) > 0 ; x++ ) { //Prints all the requisites {CourseID, PrerequisiteID}
    printf("%s %s\n", requisites[x].id, requisites[x].requisiteid);
  } */
}
Esempio n. 2
0
int main ( int arc, char *argv[] ) {

  
  for(int i = 0; i < sizeof(courses)/sizeof(courses[0]); ++i){
    setRequisites(&courses[i]);
  }
  
  printCourses(&courses[2]);
  
  for(int i = 0; i < sizeof(courses)/sizeof(courses[0]); ++i){
    printCourses(&courses[i]);
  }
  
    /* Add a function(hint:recursive) that will print for each course, its id, name and for each requisite, will add a new line indented by 8 blank, if a requisite has also a requisite, it will print it also adding an additionnal 8 blanks per level such as :

     CSC119 Introduction to UNIX/Linux
	...
	...
     CSC320 System Administration
	   CSC221 Introduction to Programming
	       CSC121 Introduction to Computing and the Web
	       CSC119 Introduction to UNIX/Linux
	   CSC119 Introduction to UNIX/Linux
     CSC323, System Administration Tool
  	    CSC320 System Administration
		   CSC221 Introduction to Programming
		       CSC121 Introduction to Computing and the Web
		       CSC119 Introduction to UNIX/Linux
		   CSC119 Introduction to UNIX/Linux
     */

}
Esempio n. 3
0
int main ( int arc, char *argv[] ) {
  for ( int x = 0 ; strlen(courses[x].id) > 0 ; x++ ) {
    setRequisites( &courses[x] );
  }

  for ( int x = 0 ; strlen(courses[x].id) > 0 ; x++ ){
    printAllCourses(&courses[x], 0);
  }
}