Upload
This commit is contained in:
parent
ace246db7b
commit
cf5b7696d2
9
.idea/.gitignore
generated
vendored
Normal file
9
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
/cmake-bui
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016-2023 筱锋xiao_lfeng
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# DataStructure_LinkList_C
|
||||
|
||||
高等院校计算机必修课(基于C语言数据结构) —— 链表(单链表)
|
||||
|
||||
作者:[筱锋xiao_lfeng](https://www.x-lf.com/)
|
||||
|
||||
注意:代码不更新,接收用户PR。
|
||||
若使用请遵循MIT开源协议
|
54
main.cpp
54
main.cpp
@ -1,6 +1,52 @@
|
||||
#include <iostream>
|
||||
/*
|
||||
* 代码说明
|
||||
* 代码由 筱锋xiao_lfeng 编写
|
||||
* 其开发者由此互联网ICP备案作者编写:粤ICP备2022014822号
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
typedef struct {
|
||||
char no[8]; //8位学号
|
||||
char name[20]; //姓名
|
||||
int score; //成绩
|
||||
} Student;
|
||||
|
||||
typedef struct Node {
|
||||
Student data; //数据域
|
||||
struct Node *next; //指针域
|
||||
} LNode;
|
||||
|
||||
//初始化一个学生信息链表,根据指定学生个数,逐个输入学生信息
|
||||
void CreatStuList(LNode *&list) {
|
||||
list = new LNode;
|
||||
}
|
||||
|
||||
//逐个显示学生表中所有学生的相关信息
|
||||
void show(LNode *&list);
|
||||
|
||||
//根据姓名进行查找,若存在则输出此学生的信息,并返回逻辑序号,否则输出“无此人”并返回0;
|
||||
int findByName(LNode *&list, char name[]);
|
||||
|
||||
//输出逻辑序号pos相应的学生信息(学号,姓名,成绩)
|
||||
int Position(int pos, LNode *&list);
|
||||
|
||||
//给定一个学生信息,插入到表中指定的位置
|
||||
int PInsert(int pos, LNode *&list, Student student);
|
||||
|
||||
// 删除指定位置的学生记录
|
||||
int Delete(int pos, LNode *&list);
|
||||
|
||||
//统计表中学生人数
|
||||
int Count(LNode *&list);
|
||||
|
||||
//释放链表
|
||||
void DestroyList(LNode *&list);
|
||||
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello, World!" << std::endl;
|
||||
return 0;
|
||||
}
|
||||
// 创建链表节点
|
||||
LNode *lNode;
|
||||
CreatStuList(lNode);
|
||||
|
||||
}
|
Reference in New Issue
Block a user