我的编号
来源:互联网 发布:人工智能 书籍 编辑:程序博客网 时间:2024/05/16 04:06
题目描述:
代码:
#include <iostream>#include <string.h>using namespace std;struct student{ int number; char name[20]; student *next;};student *createlist(int n){ int i; student *head=NULL; student *p=NULL; head=new student; head->next=NULL; p=head; cin>>p->number>>p->name; for(i=1;i<n;i++) { p->next=new student; p=p->next; p->next=NULL; cin>>p->number>>p->name; } return head;}void searchstu(student *head,char *str){ student *current; current=head; while(current!=NULL) { if(!strcmp(current->name,str)) { cout<<current->number<<endl; break; } else current=current->next; }}void destroy(student *head){ student *p; p=head; while(head!=NULL) { p=head; head=head->next; delete p; }}int main(){ int n; char str[20]; student *head; cin>>n; head=createlist(n); cin>>str; searchstu(head,str); destroy(head); return 0;}
结果展示:
0 0
- 我的编号
- YTU 2975: 我的编号
- 分类编号我所有的东西~
- 我写的sql语句(删除类别,更新编号)
- ofo缘分星期三 我的骑行编号是a255979
- SQLServer自动编号列的重新编号
- 自动获取当前编号的下一个编号
- 我常用的小模块-自动在数字、字符混合的编号后加1
- DataGrid的自动编号
- NOKIA 的手机编号
- 获取cpu的编号
- 编号的函数
- 隔离的块编号
- 自动编号的更新
- 992编号的由来
- 编号出现的次数
- 二叉树的编号
- 奶牛的编号
- nyoj 1282 部分和问题(入门题)(dfs)
- GMock
- Java面试-进阶(二)
- 正则表达式
- c++基础:拷贝初始化和直接初始化的误区
- 我的编号
- centos7 install caffe
- 机器学习笔记(十)EM算法及实践(以混合高斯模型(GMM)为例来次完整的EM)
- Still unable to dial persistent://blog.csdn.net:80 after 3 attempts
- linux执行sh脚本报错的解决办法
- Maven学习笔记(二)
- 100亿数据平滑数据迁移,不影响服务
- Codeforces #406 (Div. 2) B. Bear and Friendship Condition(并查集
- push、pop及函数调用约定