Friday, March 30, 2012

Bagian Main Dari program Double Linked List

#include <stdio.h>
#include <stdlib.h>
#include "tp4.c"
int main()
{
    int bil,pil;
    char dump;
    address p;
    doublelist A;
    createList(&A);
    do
    {
        system("cls");
        printf("Program Tugas Pendahuluan Modul 3\n\n");
        printf("=======================\n");
        printf("1. Insert first\n");
        printf("2. Delete last \n");
        printf("3. Tampil isi List\n");
        printf("4. Exit\n");
        printf("========================\n");
        printf("Pilihan : ");
        scanf("%d",&pil);
        scanf("%c",&dump);

        switch(pil)
        {
            case 1 :
                    printf("masukan bilagan : ");
                    scanf("%d",&bil);
                    p=alokasi(bil);
                    insertFirst(&A,p);
                    printf("Berhasil");
                    break;
            case 2 :
                    deleteLast(&A);
                    printf("Delete");
                    break;
            case 3 :
                    system("cls");
                    printf("Tampil Dari isi list : \n");
                    viewList(A);
                    break;
            case 4 :
                    printf("terima Kasih");
                    break;
            default :
                    printf("kode salah");

        }getche();
    }while(pil!=4);
    return 0;
}

No comments:

Post a Comment