当前位置: 首页 > news >正文

简单的Java小项目

学生选课系统

在控制台输入输出信息:
在这里插入图片描述

在eclipse上面的超级简单文件结构:
在这里插入图片描述
Main.java

package experiment_4;import java.util.*;
import java.io.*;public class Main {public static List<Course> courseList = new ArrayList<>();public static List<Teacher> teacherList = new ArrayList<>();public static List<Student> studentList = new ArrayList<>();public static void main(String[] args) {loadData();Scanner scanner = new Scanner(System.in);while (true) {System.out.println("===== 欢迎使用学生选课系统 =====");System.out.print("请输入用户名(输入exit退出):");String username = scanner.nextLine();if (username.equals("exit")) {saveData();break;}System.out.print("请输入密码:");String password = scanner.nextLine();User user = null;if (username.equals("admin")) {user = new Admin(username, courseList, teacherList, studentList);} else {user = findUserByUsername(username);}if (user == null) {System.out.println("用户不存在!");continue;}if (!user.verifyPassword(password)) {System.out.println("密码错误!");continue;}user.operate();}scanner.close();}private static User findUserByUsername(String username) {for (Teacher teacher : teacherList) {if (teacher.getUsername().equals(username)) {return teacher;}}for (Student student : studentList) {if (student.getUsername().equals(username)) {return student;}}return null;}private static void loadData() {try (ObjectInputStream ois1 = new ObjectInputStream(new FileInputStream("C:\\Users\\86183\\Desktop\\courses.txt"));ObjectInputStream ois2 = new ObjectInputStream(new FileInputStream("C:\\Users\\86183\\Desktop\\teachers.txt"));ObjectInputStream ois3 = new ObjectInputStream(new FileInputStream("C:\\Users\\86183\\Desktop\\students.txt"))) {courseList = (List<Course>) ois1.readObject();teacherList = (List<Teacher>) ois2.readObject();studentList = (List<Student>) ois3.readObject();} catch (Exception e) {System.out.println("初次运行,未找到数据文件。");}}private static void saveData() {try (ObjectOutputStream oos1 = new ObjectOutputStream(new FileOutputStream("C:\\Users\\86183\\Desktop\\courses.txt"));ObjectOutputStream oos2 = new ObjectOutputStream(new FileOutputStream("C:\\Users\\86183\\Desktop\\teachers.txt"));ObjectOutputStream oos3 = new ObjectOutputStream(new FileOutputStream("C:\\Users\\86183\\Desktop\\students.txt"))) {oos1.writeObject(courseList);oos2.writeObject(teacherList);oos3.writeObject(studentList);System.out.println("数据已保存。");} catch (IOException e) {e.printStackTrace();}}
}

Admin.java

package experiment_4;import java.util.*;
import java.io.*;public class Admin extends User {private List<Course> courseList;private List<Teacher> teacherList;private List<Student> studentList;public Admin(String username, List<Course> courseList, List<Teacher> teacherList, List<Student> studentList) {super(username);this.courseList = courseList;this.teacherList = teacherList;this.studentList = studentList;}@Overridepublic void displayMenu() {System.out.println("===== 管理员菜单 =====");System.out.println("1. 添加课程");System.out.println("2. 删除课程");System.out.println("3. 按照选课人数排序");System.out.println("4. 显示课程清单");System.out.println("5. 修改授课教师");System.out.println("6. 显示学生列表");System.out.println("7. 显示教师列表");System.out.println("8. 恢复学生和教师初始密码");System.out.println("9. 添加老师和学生");System.out.println("10. 删除老师和学生");System.out.println("0. 退出");System.out.print("请选择操作:");}@Overridepublic void operate() {Scanner scanner = new Scanner(System.in);while (true) {displayMenu();int choice = scanner.nextInt();switch (choice) {case 1:addCourse();break;case 2:deleteCourse();break;case 3:sortCoursesByStudentNumber();break;case 4:displayCourseList();break;case 5:modifyCourseTeacher();break;case 6:displayStudentList();break;case 7:displayTeacherList();break;case 8:resetPasswords();break;case 9:addUser();break;case 10:deleteUser();break;case 0:System.out.println("退出管理员系统。");return;default:System.out.println("无效的选择,请重新输入。");}}}private void addCourse() {Scanner scanner = new Scanner(System.in);System.out.print("请输入课程ID:");String courseID = scanner.nextLine();System.out.print("请输入课程名称:");String courseName = scanner.nextLine();System.out.print("请输入授课教师用户名:");String teacherName = scanner.nextLine();Teacher teacher = findTeacherByUsername(teacherName);if (teacher == null) {System.out.println("教师不存在!");return;}System.out.print("课程类型(1.必修 2.选修):");int type = scanner.nextInt();if (type == 1) {Course course = new CompulsoryCourse(courseID, courseName, teacher);courseList.add(course);// 所有学生自动加入必修课for (Student student : studentList) {student.getCoursesEnrolled().add(course);course.incrementStudentNumber();}} else if (type == 2) {System.out.print("请输入选修课最大人数:");int maxStudents = scanner.nextInt();Course course = new ElectiveCourse(courseID, courseName, teacher, maxStudents);courseList.add(course);} else {System.out.println("无效的课程类型!");return;}teacher.getCoursesTaught().add(courseList.get(courseList.size() - 1));System.out.println("课程添加成功!");}private void deleteCourse() {Scanner scanner = new Scanner(System.in);System.out.print("请输入要删除的课程ID:");String courseID = scanner.nextLine();Course course = findCourseByID(courseID);if (course != null) {courseList.remove(course);// 从教师和学生的课程列表中删除该课程course.getTeacher().getCoursesTaught().remove(course);for (Student student : studentList) {student.getCoursesEnrolled().remove(course);}System.out.println("课程删除成功!");} else {System.out.println("课程不存在!");}}private void sortCoursesByStudentNumber() {Collections.sort(courseList, new Comparator<Course>() {@Overridepublic int compare(Course c1, Course c2) {return c2.getNumberOfStudents() - c1.getNumberOfStudents();}});System.out.println("课程已按照选课人数排序!");}private void displayCourseList() {System.out.println("===== 课程清单 =====");for (Course course : courseList) {System.out.println(course);}}private void modifyCourseTeacher() {Scanner scanner = new Scanner(System.in);System.out.print("请输入要修改的课程ID:");String courseID = scanner.nextLine();Course course = findCourseByID(courseID);if (course == null) {System.out.println("课程不存在!");return;}System.out.print("请输入新教师的用户名:");String teacherName = scanner.nextLine();Teacher newTeacher = findTeacherByUsername(teacherName);if (newTeacher == null) {System.out.println("教师不存在!");return;}// 更新教师信息course.getTeacher().getCoursesTaught().remove(course);course.setTeacher(newTeacher);newTeacher.getCoursesTaught().add(course);System.out.println("授课教师修改成功!");}private void displayStudentList() {System.out.println("===== 学生列表 =====");for (Student student : studentList) {System.out.println(student.getUsername());}}private void displayTeacherList() {System.out.println("===== 教师列表 =====");for (Teacher teacher : teacherList) {System.out.println(teacher.getUsername());}}private void resetPasswords() {for (Student student : studentList) {student.setPassword("123456");}for (Teacher teacher : teacherList) {teacher.setPassword("123456");}System.out.println("学生和教师密码已重置为初始密码!");}private void addUser() {Scanner scanner = new Scanner(System.in);System.out.print("添加对象(1.教师 2.学生):");int type = scanner.nextInt();scanner.nextLine(); // 消耗换行符System.out.print("请输入用户名:");String username = scanner.nextLine();if (type == 1) {Teacher teacher = new Teacher(username);teacherList.add(teacher);System.out.println("教师添加成功!");} else if (type == 2) {Student student = new Student(username);// 将学生加入所有必修课for (Course course : courseList) {if (course instanceof CompulsoryCourse) {student.getCoursesEnrolled().add(course);course.incrementStudentNumber();}}studentList.add(student);System.out.println("学生添加成功!");} else {System.out.println("无效的类型!");}}private void deleteUser() {Scanner scanner = new Scanner(System.in);System.out.print("删除对象(1.教师 2.学生):");int type = scanner.nextInt();scanner.nextLine(); // 消耗换行符System.out.print("请输入用户名:");String username = scanner.nextLine();if (type == 1) {Teacher teacher = findTeacherByUsername(username);if (teacher != null) {teacherList.remove(teacher);// 从课程中移除教师for (Course course : courseList) {if (course.getTeacher().equals(teacher)) {course.setTeacher(null);}}System.out.println("教师删除成功!");} else {System.out.println("教师不存在!");}} else if (type == 2) {Student student = findStudentByUsername(username);if (student != null) {studentList.remove(student);// 从课程中移除学生for (Course course : student.getCoursesEnrolled()) {course.decrementStudentNumber();}System.out.println("学生删除成功!");} else {System.out.println("学生不存在!");}} else {System.out.println("无效的类型!");}}private Teacher findTeacherByUsername(String username) {for (Teacher teacher : teacherList) {if (teacher.getUsername().equals(username)) {return teacher;}}return null;}private Student findStudentByUsername(String username) {for (Student student : studentList) {if (student.getUsername().equals(username)) {return student;}}return null;}private Course findCourseByID(String courseID) {for (Course course : courseList) {if (course.getCourseID().equals(courseID)) {return course;}}return null;}
}

CompulsoryCourse.java

package experiment_4;public class CompulsoryCourse extends Course {public CompulsoryCourse(String courseID, String courseName, Teacher teacher) {super(courseID, courseName, teacher);}@Overridepublic String toString() {return super.toString() + "(必修课)";}
}

Course.java

package experiment_4;import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;public class Course implements Serializable {protected String courseID;protected String courseName;protected Teacher teacher;protected int numberOfStudents;protected List<Student> enrolledStudents;public Course(String courseID, String courseName, Teacher teacher) {this.courseID = courseID;this.courseName = courseName;this.teacher = teacher;this.numberOfStudents = 0;this.enrolledStudents = new ArrayList<>();}public String getCourseID() {return courseID;}public Teacher getTeacher() {return teacher;}public void setTeacher(Teacher teacher) {this.teacher = teacher;}public int getNumberOfStudents() {return numberOfStudents;}public void incrementStudentNumber() {this.numberOfStudents++;}public void decrementStudentNumber() {this.numberOfStudents--;}public List<Student> getEnrolledStudents() {return enrolledStudents;}@Overridepublic String toString() {return "课程ID:" + courseID + ", 课程名称:" + courseName + ", 授课教师:" + teacher.getUsername() +", 选课人数:" + numberOfStudents;}
}

ElectiveCourse.java

package experiment_4;public class ElectiveCourse extends Course {private int maxStudents;public ElectiveCourse(String courseID, String courseName, Teacher teacher, int maxStudents) {super(courseID, courseName, teacher);this.maxStudents = maxStudents;}public int getMaxStudents() {return maxStudents;}@Overridepublic String toString() {return super.toString() + ", 最大选课人数:" + maxStudents + "(选修课)";}
}

Student.java

package experiment_4;import java.util.*;public class Student extends User {private List<Course> coursesEnrolled;public Student(String username) {super(username);this.coursesEnrolled = new ArrayList<>();}@Overridepublic void displayMenu() {System.out.println("===== 学生菜单 =====");System.out.println("1. 修改登录密码");System.out.println("2. 查看自己所上课程");System.out.println("3. 选修课选课");System.out.println("0. 退出");System.out.print("请选择操作:");}@Overridepublic void operate() {Scanner scanner = new Scanner(System.in);while (true) {displayMenu();int choice = scanner.nextInt();scanner.nextLine(); // 消耗换行符switch (choice) {case 1:changePassword(scanner); // 传递 Scanner 对象break;case 2:viewCoursesEnrolled();break;case 3:selectElectiveCourse();break;case 0:System.out.println("退出学生系统。");return;default:System.out.println("无效的选择,请重新输入。");}}}public void changePassword(Scanner scanner) { // 接受 Scanner 作为参数System.out.print("请输入新密码:");String newPassword = scanner.nextLine();super.changePassword(newPassword); // 调用父类的方法}public void viewCoursesEnrolled() {System.out.println("===== 已选课程列表 =====");for (Course course : coursesEnrolled) {System.out.println(course);}}public void selectElectiveCourse() {Scanner scanner = new Scanner(System.in);System.out.print("请输入选修课ID:");String courseID = scanner.nextLine();Course course = findCourseByID(courseID);if (course == null) {System.out.println("课程不存在!");return;}if (!(course instanceof ElectiveCourse)) {System.out.println("这不是一门选修课!");return;}ElectiveCourse electiveCourse = (ElectiveCourse) course;if (electiveCourse.getNumberOfStudents() >= electiveCourse.getMaxStudents()) {System.out.println("选课人数已满!");return;}if (coursesEnrolled.contains(course)) {System.out.println("您已选过此课程!");return;}coursesEnrolled.add(course);course.incrementStudentNumber();System.out.println("选课成功!");}private Course findCourseByID(String courseID) {for (Course course : Main.courseList) {if (course.getCourseID().equals(courseID)) {return course;}}return null;}public List<Course> getCoursesEnrolled() {return coursesEnrolled;}
}

Teacher.java

package experiment_4;import java.util.*;public class Student extends User {private List<Course> coursesEnrolled;public Student(String username) {super(username);this.coursesEnrolled = new ArrayList<>();}@Overridepublic void displayMenu() {System.out.println("===== 学生菜单 =====");System.out.println("1. 修改登录密码");System.out.println("2. 查看自己所上课程");System.out.println("3. 选修课选课");System.out.println("0. 退出");System.out.print("请选择操作:");}@Overridepublic void operate() {Scanner scanner = new Scanner(System.in);while (true) {displayMenu();int choice = scanner.nextInt();scanner.nextLine(); // 消耗换行符switch (choice) {case 1:changePassword(scanner); // 传递 Scanner 对象break;case 2:viewCoursesEnrolled();break;case 3:selectElectiveCourse();break;case 0:System.out.println("退出学生系统。");return;default:System.out.println("无效的选择,请重新输入。");}}}public void changePassword(Scanner scanner) { // 接受 Scanner 作为参数System.out.print("请输入新密码:");String newPassword = scanner.nextLine();super.changePassword(newPassword); // 调用父类的方法}public void viewCoursesEnrolled() {System.out.println("===== 已选课程列表 =====");for (Course course : coursesEnrolled) {System.out.println(course);}}public void selectElectiveCourse() {Scanner scanner = new Scanner(System.in);System.out.print("请输入选修课ID:");String courseID = scanner.nextLine();Course course = findCourseByID(courseID);if (course == null) {System.out.println("课程不存在!");return;}if (!(course instanceof ElectiveCourse)) {System.out.println("这不是一门选修课!");return;}ElectiveCourse electiveCourse = (ElectiveCourse) course;if (electiveCourse.getNumberOfStudents() >= electiveCourse.getMaxStudents()) {System.out.println("选课人数已满!");return;}if (coursesEnrolled.contains(course)) {System.out.println("您已选过此课程!");return;}coursesEnrolled.add(course);course.incrementStudentNumber();System.out.println("选课成功!");}private Course findCourseByID(String courseID) {for (Course course : Main.courseList) {if (course.getCourseID().equals(courseID)) {return course;}}return null;}public List<Course> getCoursesEnrolled() {return coursesEnrolled;}
}

User.java

package experiment_4;import java.io.Serializable;//允许类的对象可以被序列化public abstract class User implements Serializable {protected String username;protected String password;//在定义该成员的类内部、同一包中的其他类、以及任何子类中(无论子类是否在同一个包中)都可以访问。public User(String username) {this.username = username;this.password = "123456"; // 初始密码}public String getUsername() {return username;}public void setPassword(String newPassword) {//设置密码this.password = newPassword;}public boolean verifyPassword(String password) {//验证密码return this.password.equals(password);}public void changePassword(String newPassword) {//修改密码this.password = newPassword;System.out.println("密码修改成功!");}public abstract void displayMenu();public abstract void operate();
}

无需用到模块化module-info.java

/*** */
/*** */
module experiment_4 {
}

相关文章:

简单的Java小项目

学生选课系统 在控制台输入输出信息&#xff1a; 在eclipse上面的超级简单文件结构&#xff1a; Main.java package experiment_4;import java.util.*; import java.io.*;public class Main {public static List<Course> courseList new ArrayList<>();publi…...

使用layui的table提示Could not parse as expression(踩坑记录)

踩坑记录 报错图如下 原因&#xff1a; 原来代码是下图这样 上下俩中括号都是连在一起的&#xff0c;可能导致解析问题 改成如下图这样 重新启动项目&#xff0c;运行正常&#xff01;...

区块链共识机制详解

一.共识机制简介 在区块链的交流和学习中&#xff0c;「共识算法」是一个很频繁被提起的词汇&#xff0c;正是因为共识算法的存在&#xff0c;区块链的可信性才能被保证。 1.1 为什么需要共识机制&#xff1f; 所谓共识&#xff0c;就是多个人达成一致的意思。我们生活中充满…...

【Excel】单元格分列

目录 分列&#xff08;新手友好&#xff09; 1. 选中需要分列的单元格后&#xff0c;选择 【数据】选项卡下的【分列】功能。 2. 按照分列向导提示选择适合的分列方式。 3. 分好就是这个样子 智能分列&#xff08;进阶&#xff09; 高级分列 Tips&#xff1a; 新手推荐基…...

【含开题报告+文档+PPT+源码】基于微信小程序的旅游论坛系统的设计与实现

开题报告 近年来&#xff0c;随着互联网技术的迅猛发展&#xff0c;人们的生活方式、消费习惯以及信息交流方式都发生了深刻的变化。旅游业作为国民经济的重要组成部分&#xff0c;其信息化、网络化的发展趋势也日益明显。旅游论坛作为旅游信息交流和分享的重要平台&#xff0…...

微软 Phi-4:小型模型的推理能力大突破

在人工智能领域&#xff0c;语言模型的发展日新月异。微软作为行业的重要参与者&#xff0c;一直致力于推动语言模型技术的进步。近日&#xff0c;微软推出了最新的小型语言模型 Phi-4&#xff0c;这款模型以其卓越的复杂推理能力和在数学领域的出色表现&#xff0c;引起了广泛…...

操作系统课后习题2.2节

操作系统课后习题2.2节 第1题 CPU的效率指的是CPU的执行速度&#xff0c;这个是由CPU的设计和它的硬件来决定的&#xff0c;具体的调度算法是不能提高CPU的效率的&#xff1b; 第3题 互斥性&#xff1a; 指的是进程之间的同步互斥关系&#xff0c;进程是一个动态的过程&#…...

[小白系列]安装sentence-transformers

python环境为3.13.1执行 pip install sentence-transformers 总是报以下问题 ERROR: Cannot install sentence-transformers0.1.0, sentence-transformers0.2.0, sentence-transformers0.2.1, sentence-transformers0.2.2, sentence-transformers0.2.3, sentence-transformers…...

Python字符串format方法全面解析

在Python中&#xff0c;format方法是一种用于格式化字符串的强大工具。它允许你构建一个字符串&#xff0c;其中包含一些“占位符”&#xff0c;这些占位符将被format方法的参数替换。以下是对format方法用法的详细解释&#xff1a; 基本用法 format方法的基本语法如下&#…...

【Reading Notes】Favorite Articles from 2024

文章目录 1、January2、February3、March4、April5、May6、June7、July8、August9、September10、October11、November12、December 1、January 2、February 3、March Sora外部测试翻车了&#xff01;3个视频都有Bug&#xff08; 2024年03月01日&#xff09; 不仔细看还真看不…...

Python爬虫之Scrapy框架基础入门

Scrapy 是一个用于Python的开源网络爬虫框架&#xff0c;它为编写网络爬虫来抓取网站数据并提取结构化信息提供了一种高效的方法。Scrapy可以用于各种目的的数据抓取&#xff0c;如数据挖掘、监控和自动化测试等。 【1】安装 pip install scrapy安装成功如下所示&#xff1a;…...

spring cloud contract mq测试

对于spring cloud contract的环境配置和部署&#xff0c;请看我之前的文章。 一 生产者测试 测试生产者是否发送出消息&#xff0c;并测试消息内容是否正确。 编写测试合同 测试基类&#xff08;ContractTestBase&#xff09;上面要添加下面注解 SpringBootTest AutoConfig…...

Axure原型设计技巧与经验分享

AxureRP作为一款强大的原型设计工具&#xff0c;凭借其丰富的交互设计能力和高保真度的模拟效果&#xff0c;赢得了众多UI/UX设计师、产品经理及开发人员的青睐。本文将分享一些Axure原型设计的实用技巧与设计经验&#xff0c;帮助读者提升工作效率&#xff0c;打造更加流畅、用…...

计算机网络之王道考研读书笔记-1

第 1 章 计算机网络体系结构 1.1 计算机网络概述 1.1.1 计算机网络概念 internet(互连网)&#xff1a;泛指由多个计算机网络互连而成的计算机网络。这些网络之间可使用任意通信协议。 Internet(互联网或因特网)&#xff1a;指当前全球最大的、开放的、由众多网络和路由器互连…...

服务器限制某个端口只允许特定IP访问(处理第三方依赖漏洞)

最近项目部署之后&#xff0c;有些客户开始进行系统系统漏洞扫描&#xff0c;其中出现问题多的一个就是我们项目所依赖的Elasticsearch&#xff08;es检索服务&#xff09;&#xff0c;很容易就被扫出来各种高危漏洞&#xff0c;而且这些漏洞我们在处理起来是很棘手的&#xff…...

JavaScript--原型与原型链

在JavaScript中&#xff0c;原型&#xff08;prototype&#xff09;是一个非常重要且独特的概念&#xff0c;它在对象创建和继承方面发挥着关键作用。理解原型及其相关的机制有助于更好地理解JavaScript的对象模型&#xff0c;以及如何设计和使用对象和继承。 JavaScript–原型…...

hive—常用的日期函数

目录 1、current_date 当前日期 2、now() 或 current_timestamp() 当前时间 3、datediff(endDate, startDate) 计算日期相差天数 4、months_between(endDate, startDate) 日期相差月数 5、date_add(startDate, numDays) 日期加N天 6、date_sub(startDate, numDays) 日期减…...

HTML零基础入门教学

目录 一. HTML语言 二. HTML结构 三. HTML文件基本结构 四. 准备开发环境 五. 快速生成代码框架 六. HTML常见标签 6.1 注释标签 6.2 标题标签&#xff1a;h1-h6 6.3 段落标签&#xff1a;p 6.4 换行标签&#xff1a;br 6.5 格式化标签 6.6 图片标签&a…...

vue3 父组件调用子组件 el-drawer 抽屉

之前 Vue3 只停留在理论&#xff0c;现在项目重构&#xff0c;刚好可以系统的实战一下&#xff0c;下面是封装了一个抽屉表单组件&#xff0c;直接在父组件中通过调用子组件的方法打开抽屉&#xff1a; 父组件&#xff1a; <template><div id"app"><…...

Java中常用算法之选择排序算法

一.选择排序&#xff08;Selection Sort&#xff09;是一种简单直观的排序算法。它的工作原理是每次从未排序部分选择最小&#xff08;或最大&#xff09;的元素&#xff0c;并将其放到已排序部分的末尾。以下是用Java实现选择排序的代码及其详细讲解。 二.选择排序代码 publ…...

挑战杯推荐项目

“人工智能”创意赛 - 智能艺术创作助手&#xff1a;借助大模型技术&#xff0c;开发能根据用户输入的主题、风格等要求&#xff0c;生成绘画、音乐、文学作品等多种形式艺术创作灵感或初稿的应用&#xff0c;帮助艺术家和创意爱好者激发创意、提高创作效率。 ​ - 个性化梦境…...

React19源码系列之 事件插件系统

事件类别 事件类型 定义 文档 Event Event 接口表示在 EventTarget 上出现的事件。 Event - Web API | MDN UIEvent UIEvent 接口表示简单的用户界面事件。 UIEvent - Web API | MDN KeyboardEvent KeyboardEvent 对象描述了用户与键盘的交互。 KeyboardEvent - Web…...

相机从app启动流程

一、流程框架图 二、具体流程分析 1、得到cameralist和对应的静态信息 目录如下: 重点代码分析: 启动相机前,先要通过getCameraIdList获取camera的个数以及id,然后可以通过getCameraCharacteristics获取对应id camera的capabilities(静态信息)进行一些openCamera前的…...

[Java恶补day16] 238.除自身以外数组的乘积

给你一个整数数组 nums&#xff0c;返回 数组 answer &#xff0c;其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请 不要使用除法&#xff0c;且在 O(n) 时间复杂度…...

Reasoning over Uncertain Text by Generative Large Language Models

https://ojs.aaai.org/index.php/AAAI/article/view/34674/36829https://ojs.aaai.org/index.php/AAAI/article/view/34674/36829 1. 概述 文本中的不确定性在许多语境中传达,从日常对话到特定领域的文档(例如医学文档)(Heritage 2013;Landmark、Gulbrandsen 和 Svenevei…...

【C++特殊工具与技术】优化内存分配(一):C++中的内存分配

目录 一、C 内存的基本概念​ 1.1 内存的物理与逻辑结构​ 1.2 C 程序的内存区域划分​ 二、栈内存分配​ 2.1 栈内存的特点​ 2.2 栈内存分配示例​ 三、堆内存分配​ 3.1 new和delete操作符​ 4.2 内存泄漏与悬空指针问题​ 4.3 new和delete的重载​ 四、智能指针…...

Golang——6、指针和结构体

指针和结构体 1、指针1.1、指针地址和指针类型1.2、指针取值1.3、new和make 2、结构体2.1、type关键字的使用2.2、结构体的定义和初始化2.3、结构体方法和接收者2.4、给任意类型添加方法2.5、结构体的匿名字段2.6、嵌套结构体2.7、嵌套匿名结构体2.8、结构体的继承 3、结构体与…...

Linux部署私有文件管理系统MinIO

最近需要用到一个文件管理服务&#xff0c;但是又不想花钱&#xff0c;所以就想着自己搭建一个&#xff0c;刚好我们用的一个开源框架已经集成了MinIO&#xff0c;所以就选了这个 我这边对文件服务性能要求不是太高&#xff0c;单机版就可以 安装非常简单&#xff0c;几个命令就…...

解析两阶段提交与三阶段提交的核心差异及MySQL实现方案

引言 在分布式系统的事务处理中&#xff0c;如何保障跨节点数据操作的一致性始终是核心挑战。经典的两阶段提交协议&#xff08;2PC&#xff09;通过准备阶段与提交阶段的协调机制&#xff0c;以同步决策模式确保事务原子性。其改进版本三阶段提交协议&#xff08;3PC&#xf…...

CTF show 数学不及格

拿到题目先查一下壳&#xff0c;看一下信息 发现是一个ELF文件&#xff0c;64位的 ​ 用IDA Pro 64 打开这个文件 ​ 然后点击F5进行伪代码转换 可以看到有五个if判断&#xff0c;第一个argc ! 5这个判断并没有起太大作用&#xff0c;主要是下面四个if判断 ​ 根据题目…...