⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list_find.c

📁 c语言版的学生成绩管理系统
💻 C
字号:
#include<stdio.h>typedef struct link{    char str[20];    int  num;    struct link *next;}*head;main(){    void compare_int(head p,int *cnt);    void compare_string(head P,char *str);    void list_search(void *value1,void *node,void (*compare)(void *link_head,void * value));    void create();    void emiat}void compare_int(void *value,void *per){    struct link *P=(struct link)per;    int *val=(int *)value;    while(p!=NULL){        if(per->num==*val){            printf("the value %d find\n",*val );            return ;           }        else if(per->num>*val){                     printf("the value %d find\n",*val);                 return;             }             else if(per->num<*val){                      printf("the value %d find\n",*val);                      return;                  }        p=p->next;    }   printf("have not find %d \n",*val);}void compare_string(void *value ,void *string){    int i=0;    char flage;    flage='T';    while(*(value+i)!=0&&*(string+i)!=0){        if(*(value+i)!=*(string+i)){            flage='F';            break;        }        ++i;    }    if(*(value+i)==0||*(string+i)==0)        flage='F';    if(flage=='T')        printf("the string of %s has found\n",string);    else         printf("the string of %s has not found\n",string);}void list_search(void *value,void *node,void (*compare)(void *value,void *head)){    while(node!=NULL){        compare(value,node);        node=node->next;    }}void enter_value(){    printf("what kind do want to search?\ns: is string ,n:is number\n");    char c;    char temp[20];    int cnt;    c=getchar();    if(c=='s'){        printf("please enter the string\n");        scanf("%s",temp);        getchar();        list_search(&tmep,head,compare_string);    }    else if(c=='n'){        printf("please enter the number\n");        scanf("%d",cnt);        list_search(&cnt,head,compare_int);    }else {printf("your enter is illegal\n");           exit(0);          }}void create(){    head p;    head=p=(head)malloc(sizeof(struct link));    head->num=12;    head->str="hello";    } 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -