Advertisement

C语言 通讯录管理

阅读量:
复制代码
    typedef struct Info
    {
    char name[15];/*姓名*/
    char city[10];/*城市*/
    char province[10];/*省*/
    char state[10];/*国家*/
    char tel[15];/*电话*/
    };
    typedef struct node/*定义通讯录链表的结点结构*/
    {
    struct Info data;
    struct node *next;
    }Node,*link;
    
    void stringinput(char *t,int lens,char *notice)
    {
       char n[50];
       do{
      printf(notice); /*显示提示信息*/
      scanf("%s",n); /*输入字符串*/
      if(strlen(n)>lens)printf("\n exceed the required length! \n"); /*超过lens值重新输入*/
     }while(strlen(n)>lens);
       strcpy(t,n); /*将输入的字符串拷贝到字符串t中*/
    }
    vo

全部评论 (0)

还没有任何评论哟~