• Uncategorized 13.03.2014

    #include <stdio.h>
    #include <stdlib.h>

    struct link{
    int i;
    struct link*next;
    };

    int main(){
    int j;
    struct link*edge;
    struct link*head;
    head=(struct link*)malloc(sizeof(struct link));
    head->next=0;
    do{
    printf(“Input number:”);
    scanf(“%d”,&head->i);
    fflush(stdin);
    }while(head->i<1||head->i>100);

    edge=head;
    edge->next=(struct link*)malloc(sizeof(struct link));
    edge=edge->next;
    edge->next=0;

    for(int k=0;k<1;k++)
    {
    if(edge==0)
    {
    break;
    }
    }

    for(j=0;j<10;j++){
    system(“cls”);
    edge=head;
    while(edge->next>0)
    {
    printf(“%d”,edge->i);
    edge=edge->next;
    printf(“->”);
    }
    do
    {
    printf(“\nInput Number:”);
    scanf(“%d”,&edge->i);
    fflush(stdin);
    }while(edge->i<1 || edge->i>100);

    edge->next=(struct link*)malloc(sizeof(struct link));
    edge=edge->next;
    edge->next=0;
    }

    getchar();
    return 0;
    }

    Posted by rio18 @ 5:35 pm

  • Leave a Reply

    Your email address will not be published. Required fields are marked *