/* The application */
int main(int argc, const char * argv[]) {
    TOrderedList list; Titem item;
    int i;
    
    initialize_list(&list);
    printf("\n Enter items in any order\n");
    
    for (i = 0 ; i < 5 ; i++) {
        read_item(&item);
        if (!insert_item(&list, item))
            printf("\nList is full");
    }
    
    printf("\nList ouputted using for loop and retrieve_ith function:\n");
    for (i=0; i<number_of_items(&list); i++) {
        retrieve_ith(&list, i, &item);
        print_item(item);
    }
    
    return 0;
}
Ejemplo n.º 2
0
int main (void) {
    TOrderedList list;
    Titem item;
    int i , succeed, no, result;
    initialize_list(&list);
    printf("\n Enter items in any order\n");

    for (i = 0 ; i < 5 ; i++) {
        read_item(&item);
        if (!insert_item(&list, item))
            printf("\nList is full");
    }

    printf("List ouputted using for loop and retrieve_ith function:\n");
    for (i=0; i<number_of_items(&list); i++) {
        retrieve_ith(&list, i, &item);
        print_item(item);
    }
    system("pause");
    return 0;
}