为什么scanf函数无法结束输入,该如何解决

为什么scanf函数无法结束输入
scanf 函数无法结束输入,一直可以输入,按回车时会换行,但依然可以输入,这是怎么回事呢

------解决方案--------------------
在scanf后面接着用getchar来接收回车键试试。
------解决方案--------------------
scanf("%s %s %s %s",new->name,new->corp,new->phone,new->address);
 ==>
scanf("%s%s%s%s",new->name,new->corp,new->phone,new->address);
 
先像上面那样修改再说.

什么编辑器?怎么把行号一起复制过来了??

------解决方案--------------------
改成这样了.
似乎是能够跳出去的..至于其他逻辑问题,你自己改吧.
C/C++ code

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

struct Touch
{
    char name[20];
    char corp[20]; //work
    char phone[20];
    char address[50];
    struct Touch* next;
};
typedef struct Touch AddressInfo;
#define new newp
AddressInfo* Create()
{
    int num, i;
    AddressInfo* head, *p, *new;
    head = (AddressInfo *)malloc(sizeof(AddressInfo));
    if(!head)
    {
        printf("Fail to assign memory !\n");
        exit(1);
    }
    new = p = head;
    printf("Input the first person data :\n");
    scanf("%s %s %s %s", head->name, head->corp, head->phone, head->address);
    head->next = NULL;
    printf("Input the number you want to save :\n");
    scanf("%d", &num);
    for(i = 0; i < num; i++)
    {
        new = (AddressInfo *)malloc(sizeof(AddressInfo));
        if(!new)
        {
            printf("Fail to assign memory !\n");
            exit(1);
        }
        p->next = new; //combine
        printf("Input the %d person's data :\n", i + 1);
        scanf("%s %s %s %s", new->name, new->corp, new->phone, new->address);
        p = new;
        p->next = NULL;

    }
    p = head;
    while(p != NULL)
    {
        printf("%s\t%s\t%s\t%s\n", p->name, p->corp, p->phone, p->address);
        p = p->next;
    }
    printf("\n");

    return head;
}
void Save(AddressInfo* head)
{
    AddressInfo* p;
    FILE* fp;
    if((fp = fopen("Address.txt", "wb")) == NULL)
    {
        printf("File open error!\n");
        exit(0);
    }
    for(p = head; p->next != NULL; p = p->next)
    {
        if(1 != fwrite(p, sizeof(AddressInfo), 1, fp))
            break;
    }

    if(fclose(fp))
    {
        printf("Can not close the file\n");
        exit(0);
    }

}

AddressInfo* load()
{
    AddressInfo* p, *new, *head;
    p = new = head = NULL;
    FILE* fp;

    if((fp = fopen("Address.txt", "rb")) == NULL)
    {
        printf("can not open file\n");
        exit(1);
    }
    printf("\n -----Loading file!-----\n");
    head = (AddressInfo *)malloc(sizeof(AddressInfo));
    if(!head)
    {
        printf("out of memory!\n");
        return NULL;
        p = head;
        while(!feof(fp))
        {
            if(1 != fread(p, sizeof(AddressInfo), 1, fp))
                break;
            new = (AddressInfo *)malloc(sizeof(AddressInfo));
            if(!new)
            {
                printf("Error to assign memory!\n");
                return head;
            }
            p->next = new;
            p = new;
        }
        p->next = NULL;
        fclose(fp);
        printf("Load success !\n");
        return head;

    }
}







AddressInfo* Addition(AddressInfo* head, int n)
{
    puts(__FUNCTION__);
    int i;
    AddressInfo* p, *new;
    p = head;
    while(p->next != NULL) //Find the last node
    {
        p = p->next;
    }
    printf("%d\n", n);
    for(i = 0; i < n; i++)
    {
        new = (AddressInfo *)malloc(sizeof(AddressInfo));
        if(!new)
        {
            printf("Fail to assign memory !\n");
            exit(1);
        }
        p->next = new;
        scanf("%s%s%s%s", new->name, new->corp, new->phone, new->address);
        p = new;
        p->next = NULL;

    }
    p = head;
    while(p->next != NULL)
    {
        printf("%s\t%s\t%s\t%s\n", p->name, p->corp, p->phone, p->address);
    }
    printf("\n");
    puts(__FUNCTION__);
    return head;
}



int main()
{
    char c;
    int n;
    AddressInfo* head, *p;
    head = Create(); //create a Touch_person linkes list
    Save(head);
    printf("Please choise :\nA: Add a person in the end\nD: Delete a person\nF: Find a person\nI: Insert a person\nP: Print all persons\nE: exit\n");

    while(1)
    {
        c = getchar();
        if(c == 'a')
        {
            head = load();
            printf("Input the number of u want to add :\n");
            scanf("%d", &n);
            head = Addition(head, n);
            Save(head);
        }

    }
    return 0;
}