コード例 #1
0
void print_results(Event *e){
    int i, total_hours, total_mins;
    Entrant *entrant;

    printf("-------------------------------------------------------------------------------\n");
    printf("|Competitor           |  Course  |  Start Time |   End Time  |     Total      |\n");
    printf("|-----------------------------------------------------------------------------|\n");
    
    for (i=0; i< e->no_of_entrants-1; i++) {
        total_hours = 0;
        total_mins = 0;
    
        entrant = (Entrant*)get_element_data(e->entrantlist.head, i);
        
        if(entrant->state.type == COMPLETED) {
                total_hours = calc_total_time(entrant->start_time, entrant->end_time);
                total_mins = calc_total_time(&entrant->start_time[3], &entrant->start_time[3]);
        }
        
        printf("|%-21s|    %c     |    %s    |    %s    |  %.2dhrs %.2dmins  |\n", 
                entrant->name, entrant->course, 
                entrant->start_time, entrant->end_time, 
                total_hours, total_mins);
    }
    
    printf("-------------------------------------------------------------------------------\n");
}
コード例 #2
0
ファイル: main.c プロジェクト: ssherar/cs22510
/**
 * Prints out a competitor
 * @param comp the competitor
 */
void print_competitor(struct Competitor comp) {
    printf("%-30s %-10d %-15c %-15s %-15s %-15s\n",
            comp.name,
            comp.id,
            comp.course_id,
            comp.course.start_time,
            comp.course.end_time,
            calc_total_time(comp.course));
}