当前位置:首页 > 代码 > 正文

学生宿舍管理系统源代码(学生宿舍管理系统源代码JAVA)

admin 发布:2022-12-19 16:48 158


本篇文章给大家谈谈学生宿舍管理系统源代码,以及学生宿舍管理系统源代码JAVA对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

宿舍管理系统源代码

最好你自己试着做一做,问问管理宿舍的老师这些方面的东西,可以学到不少东西的!

那也好办,可以到网上搜索下载一份,百度或GOOGLE输入“宿舍管理系统”有很多

也可以花钱找人专门给你做一份!

希望对你能有所帮助。

C语言学生宿舍管理系统设计

这个估计也没有人给你写,这个实际和学生成绩管理系统一样的,我给你说个思路吧,还是自己看看书写吧,不是很难的。

首先你要建立一个结构体,来表示学生宿舍的基本信息,

typedef struct

{

int num_1;

int num_2;

float s;

int have_num;

int lea_num;

}Dom;

typedef struct DNode

{

Dom dom;

DNode *next;

}DNode;

然后,你要用链表实现,在main函数里面用switch语句来转向你要实现的功能,然后各个函数就要你自己写了,实际就是链表的插入删除的一些基本操作,加加油吧

求一份Java 学生宿舍管理系统,有源码,求大神,先谢啦

import java.awt.BorderLayout;

import java.awt.CardLayout;

import java.awt.Container;

import java.awt.Font;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.Icon;

import javax.swing.ImageIcon;

import javax.swing.JButton;

import javax.swing.JFrame;

import javax.swing.JLabel;

import javax.swing.JMenu;

import javax.swing.JMenuBar;

import javax.swing.JMenuItem;

import javax.swing.JPanel;

import javax.swing.JToolBar;

import javax.swing.SwingConstants;

public class MainFrame extends JFrame implements ActionListener{

InsertPanel ip = null;

SelectPanel sp = null;

JPanel pframe;

JButton jb1,jb2,jb3;

JMenuItem jm11,jm21,jm22,jm23,jm31,jm32,jm41,jm42;

CardLayout clayout;

public MainFrame(String s){

super(s);

JMenuBar mb = new JMenuBar();

this.setJMenuBar(mb);

JMenu m1 = new JMenu("系统");

JMenu m2 = new JMenu("基本信息");

JMenu m3 = new JMenu("成绩");

JMenu m4 = new JMenu("奖惩");

mb.add(m1);

mb.add(m2);

mb.add(m3);

mb.add(m4);

jm11 = new JMenuItem("退出系统");

jm21 = new JMenuItem("输入");

jm22 = new JMenuItem("查询");

jm23 = new JMenuItem("更改");

jm31 = new JMenuItem("输入成绩");

jm32 = new JMenuItem("查询成绩");

jm41 = new JMenuItem("奖励");

jm42 = new JMenuItem("处分");

m1.add(jm11);

m2.add(jm21);

m2.add(jm22);

m2.add(jm23);

m3.add(jm31);

m3.add(jm32);

m4.add(jm41);

m4.add(jm42);

Icon i1 = new ImageIcon();

Icon i2 = new ImageIcon();

Icon i3 = new ImageIcon();

jb1 = new JButton(i1);

jb1.setToolTipText("输入");

jb2 = new JButton(i2);

jb2.setToolTipText("查询");

jb3 = new JButton(i3);

jb3.setToolTipText("退出");

JToolBar tb = new JToolBar("系统工具");

tb.add(jb1);

tb.add(jb2);

tb.add(jb3);

add(tb,BorderLayout.NORTH);

jm11.addActionListener(this);

jm21.addActionListener(this);

jm22.addActionListener(this);

jb1.addActionListener(this);

jb2.addActionListener(this);

jb3.addActionListener(this);

clayout = new CardLayout();

pframe = new JPanel(clayout);

add(pframe);

JPanel mainp = new JPanel(new BorderLayout());

JLabel mainl = new JLabel("学生信息管理平台",SwingConstants.CENTER);

mainl.setFont(new Font("serif",Font.BOLD,30));

mainp.add(mainl);

pframe.add(mainp,"main");

clayout.show(pframe, "main");

}

public void actionPerformed(ActionEvent e){

if(e.getSource() == jm21 || e.getSource() == jb1){

if(ip == null){

ip= new InsertPanel();

pframe.add(ip,"insert");

}

clayout.show(pframe, "insert");

this.setTitle("输入学生信息");

}

else if(e.getSource() == jm22 || e.getSource() == jb2){

if(sp == null){

sp= new SelectPanel();

pframe.add(sp,"select");

}

clayout.show(pframe, "select");

this.setTitle("查询学生信息");

}

else if(e.getSource() == jm11 || e.getSource() == jb3){

System.exit(0);

}

}

}

第二个:

import javax.swing.JFrame;

public class MainTest {

public static void main(String [] args){

MainFrame f = new MainFrame("学生信息管理平台");

f.setSize(400,300);

f.setLocation(350,250);

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);

}

}

第二个:

import java.sql.Connection;

import java.sql.DriverManager;

public class MySQLConnection {

static Connection getCon(){

Connection con = null;

try{

Class.forName("com.mysql.jdbc.Driver");

con = DriverManager.getConnection("jdbc:mysql://localhost/test","root","123");

}

catch(Exception e){

System.out.println("建立数据库连接遇到异常!");

}

return con;

}

}

第四个:

import java.awt.BorderLayout;

import java.awt.GridLayout;

import java.awt.event.ActionEvent;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JLabel;

import javax.swing.JOptionPane;

import javax.swing.JPanel;

import javax.swing.JTextField;

import javax.swing.SwingConstants;

public class SelectPanel extends JPanel implements ActionListener{

JButton jb;

JTextField jt;

JTextField jt1,jt2,jt3,jt4;

public SelectPanel(){

JLabel jl = new JLabel("请输入学号:",SwingConstants.CENTER);

jt = new JTextField();

jb = new JButton("确定");

JPanel jp1 = new JPanel(new GridLayout(1,3));

jp1.add(jl);

jp1.add(jt);

jp1.add(jb);

JLabel j1,j2,j3,j4;

j1 = new JLabel("学号:",SwingConstants.CENTER);

j2 = new JLabel("姓名:",SwingConstants.CENTER);

j3 = new JLabel("性别:",SwingConstants.CENTER);

j4 = new JLabel("年龄:",SwingConstants.CENTER);

jt1 = new JTextField(6);

jt1.setEditable(false);

jt2 = new JTextField(6);

jt2.setEditable(false);

jt3 = new JTextField(6);

jt3.setEditable(false);

jt4 = new JTextField(6);

jt4.setEditable(false);

JPanel jp2 = new JPanel(new BorderLayout());

JPanel jp3 = new JPanel(new GridLayout(4,2));

jp2.add(new JLabel(""),BorderLayout.NORTH);

jp3.add(j1);

jp3.add(jt1);

jp3.add(j2);

jp3.add(jt2);

jp3.add(j3);

jp3.add(jt3);

jp3.add(j4);

jp3.add(jt4);

jp2.add(jp3);

this.setLayout(new BorderLayout());

add(jp1,BorderLayout.NORTH);

add(jp2);

jb.addActionListener(this);

}

public void actionPerformed(ActionEvent e){

if(e.getSource() == jb){

String stuNo = jt.getText().trim();

Student s = new Student();

boolean b = true;

try{

b = s.selectByStuNo(stuNo);

}

catch(Exception ex){

System.out.println("查询学生信息遇到异常!");

}

if(b){

jt1.setText(s.getStuNo());

jt2.setText(s.getName());

jt3.setText(s.getGender());

int a = s.getAge();

Integer i = new Integer(a);

jt4.setText(i.toString());

}

else{

JOptionPane.showMessageDialog(null, "无此学生!");

}

}

}

}

学生宿舍管理系统,C++源码

#include iostream

#include string

#include fstream

#include ctime

using namespace std;

class student

{

private:

long int stu_num; //学号,宿舍号

char stu_name[40]; //姓名

char class_name[40]; //班别

char house_name[20]; //宿舍

public:

student()

{

stu_num=0;

stu_name[0] =0;

class_name[0] =0;

house_name[0] =0;

}

student::student(long a, char * b,char *c,char *d)

{

Setdata(a , b, c, d);

}

char * Getstuname(void) //姓名查找

{

return stu_name ;

}

long Getstunum(void) //学号查找

{

return stu_num;

}

char * Gethousename(void) //宿舍号查找

{

return house_name;

}

char * Getclassname(void) //按班级查找

{

return class_name;

}

void Setdata(long a, char *b,char *c,char *d)

{

stu_num = a;

strcpy(stu_name, b);

strcpy(class_name, c);

strcpy(house_name, d);

}

void Show(void)

{

cout"学号:"stu_num"\t""姓名:"stu_name"\t";

cout"班级:"class_name"\t\t""宿舍:"house_name"\n";

}

};

void main(void)

{

student s1;

int flags=0;

long stu_num; //学号

char stu_name[40]; //姓名

char class_name[40]; //班级

char house_name[20]; //宿舍

time_t t;

time(t);

ifstream file1;

ofstream file3;

char flag = 'y';

cout "---------------------------------学生成绩管理系统-------------------------------"endl;

cout "\t\t\t 时间:" ctime(t);

while( flag=='y' || flag=='Y')

{ //由flag控制循环

cout"--------------------------------------------------------------------------------\n";

cout"\t\t 1:注册学生!\n";

cout"\t\t 2:按学号查看学生信息!\n";

cout"\t\t 3:按宿舍号查看学生信息!\n";

cout"\t\t 4:按姓名查看学生信息!\n";

cout"\t\t 5:按班级查看学生信息!\n";

cout"\t\t 6:显示全部学生信息\n";

// cout"\t\t 7:按学号修改学生信息\n";

// cout"\t\t 8:按学号删除学生信息!\n";

cout"--------------------------------------------------------------------------------\n";

cout"请输入选择:";

char choice;

cinchoice;

switch(choice)

{

case '1':

file3.open("c:\\stu.dat",ios::app|ios::binary);

input: flags=0;

cout"输入学号:";

cinstu_num;

while (stu_num100000 || stu_num999999)

{

cin.clear();

rewind(stdin);

cout "你输入的学号不正确,请输入一个六位数的学号" endl;

cout "学号:";

cin stu_num;

}

file1.open("c:\\stu.dat",ios::in | ios::binary | ios::beg);//按读方式打开文件

while(!file1.eof())

{

int n;

file1.read((char *)s1,sizeof(student));

n=file1.gcount();

if(n==sizeof(student))

{

if(s1.Getstunum()==stu_num)

flags=1;

}

}

file1.clear();

file1.close();

if (flags==1)

{

cin.clear();

cout "学号重复,请重输入!" endl;

goto input;

}

cout"输入姓名:"; cinstu_name;

cout"输入班级:"; cinclass_name;

cout"输入宿舍:"; cinhouse_name;

s1.Setdata(stu_num,stu_name,class_name,house_name);

file3.write((char*)s1,sizeof(s1));

file3.clear();

file3.close();

break;

case '2': //按学号查找

cout"请输入学生的学号:";

cinstu_num;

while (stu_num100000 || stu_num999999)

{

cin.clear();

rewind(stdin);

cout "你输入的学号不正确,请输入一个六位数的学号" endl;

cout "学号:";

cin stu_num;

}

file1.open("c:\\stu.dat",ios::in | ios::binary | ios::beg);//按读方式打开文件

while(!file1.eof())

{

int n;

file1.read((char *)s1,sizeof(student));

n=file1.gcount();

if(n==sizeof(student))

{

if(s1.Getstunum()==stu_num) //显示学生信息

{

s1.Show();

flags=1;

}

}

}

file1.clear();

file1.close();

if (flags==0)

cout "没有找学号为:" stu_num "的学生记录!" endl;

flags=0;

break;

case '3': //按宿舍号查找

cout"请输入宿舍号:";

cinhouse_name;

file1.open("c:\\stu.dat",ios::in | ios::binary | ios::beg);//按读方式打开文件

while(!file1.eof())

{

int n;

file1.read((char *)s1,sizeof(student));

n=file1.gcount();

if(n==sizeof(student))

{

if(strcmp(s1.Gethousename(),house_name)==0)

{

s1.Show();

flags=1;

}

}

}

file1.clear();

file1.close();

if (flags==0)

cout "没有找到宿舍为:" house_name "的学生记录!" endl;

flags=0;

break;

case '4': //按姓名查找

cout"请输入学生姓名:";

cinstu_name;

file1.open("c:\\stu.dat",ios::in | ios::binary | ios::beg);//按读方式打开文件

while(!file1.eof())

{

int n;

file1.read((char *)s1,sizeof(student));

n=file1.gcount();

if(n==sizeof(student))

{

if(strcmp(s1. Getstuname(),stu_name)==0)

{

s1.Show();

flags=1;

}

}

}

file1.clear();

file1.close();

if (flags==0)

cout "没有找到姓名为:" stu_name "的学生记录!" endl;

flags=0;

break;

case '5': //按班级查找

cout"请输入班级名称:";

cinclass_name;

file1.open("c:\\stu.dat",ios::in | ios::binary | ios::beg);//按读方式打开文件

while(!file1.eof())

{

int n;

file1.read((char *)s1,sizeof(student));

n=file1.gcount();

if(n==sizeof(student))

{

if(strcmp(s1. Getclassname(),class_name)==0)

{

s1.Show();

flags=1;

}

}

}

file1.clear();

file1.close();

if (flags==0)

cout "没有找到该班级为:" class_name "的学生记录!" endl;

flags=0;

break;

case '6': //显示全部学生信息

file1.open("c:\\stu.dat",ios::in | ios::binary);//按读方式打开文件

while(!file1.eof())

{

int n;

file1.read((char *)s1,sizeof(student));

n=file1.gcount();

if(n==sizeof(student))

{

s1.Show();

flags=1;

}

}

file1.clear();

file1.close();

if (flags==0)

cout "数据库没有记录!" endl;

flags=0;

break;

// case '7': //修改学生信息按学号

// flags=0;

// cout"请输入要修改学生的学号:";

// cinstu_num;

// while (stu_num100000 || stu_num999999)

// {

// cin.clear();

// rewind(stdin);

// cout "你输入的学号不正确,请输入一个六位数的学号" endl;

// cout "学号:";

// cin stu_num;

// }

// file1.open("c:\\stu.dat",ios::in | ios::binary | ios::beg);//按读方式打开文件

// while(!file1.eof())

// {

// int n;

// file1.read((char *)s1,sizeof(student));

// n=file1.gcount();

// if(n==sizeof(student))

// {

// if(s1.Getstunum()==stu_num)

// {

// file3.open("c:\\stu.dat",ios::out|ios::binary);

// cout"输入姓名:"; cinstu_name;

// cout"输入班级:"; cinclass_name;

// cout"输入宿舍:"; cinhouse_name;

// s1.Setdata(stu_num,stu_name,class_name,house_name);

// file3.write((char*)s1,sizeof(s1));

// file3.close();

// flags=1;

// }

// }

// }

// file1.clear();

// file1.close();

// if (flags==0)

// {

// cout "没有此学生记录,不能进行修改!" endl;

// break;

// }

// break;

// case '8': //删除学生信息按学号

default: flag = 'n';

break;

}

}

cout "谢谢您的使用!" endl;

}

学生寝室管理系统设计与实现 数据结构

宿舍管理,没什么好玩的,就是繁琐,很多东西需要你细化,而且一般要求为交互式平台,而且选项多,出错处较多,排错就是一个相当大的工程。我写的这个里面没有太多的排错功能,因为那东西就是烦而已,多几个if 判断下而已,因为烦的慌,觉得也没啥意思,就没细细的写,粗略的写了几个。 查询也是只写了按学号查询,是用的折半查找。排序是用的快速排序,因为时间消耗比较小,喏,那是上个排序综合里有的,所以写这个就用的那个里的快速排序,很简单,就是对copy下而已,改下结构体,complete!呵呵,程序如下:头文件里的:struct student

{

char name[10];

int num;

int dormin;

};cpp文件:// 宿舍管理.cpp : 定义控制台应用程序的入口点。

//

///////////////////////////////////////////////////////////////////////

/*8、宿舍管理查询软件(**)

任务:为宿舍管理人员编写一个宿舍管理查询软件, 程序设计要求:

(1)采用交互工作方式

(2)可以增加、删除、修改信息

(3)建立数据文件 ,数据文件按关键字(姓名、学号、房号)进行排序(选择、快速排序、堆排序等任选一种)

(4) 查询 : a.按姓名查询 ;b.按学号查询 ;c按房号查询

(5) 打印任一查询结果(可以连续操作)

*/

/////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#includefstream

#includestdlib.h

#includeiostream

using namespace std;

#define max 10

int _tmain(int argc, _TCHAR* argv[])

{void input(student *,int);void display(student *,int);void add(student *,int ,int);brvoid qsort(student *,int,int);void del(student *,char *,int );void change(student *,char *,int );brvoid search(student *,int,int,int);/ppint stunum,choose;brifstream infile("stunum.txt");brif(!infile) cout"文件中尚未创建信息!"endl;brelse infilestunum;brinfile.close();/ppchar name[10];brcout"****************************************************"endl;brcoutendlendl;brcout" 欢迎进入学生宿舍管理系统!!"endl;brcoutendlendl;brcout"****************************************************"endl;brwhile(1){brcout"1.输入学生宿舍信息"endl;brcout"2.显示已输入信息"endl;brcout"3.信息修改"endl;brcout"4.信息查询"endl;brcout"5.信息排序"endl;brcout"6.退出系统"endl;brcout"请输入需要执行的任务:";brcinchoose;brstudent *S;S=new student[max];brswitch(choose){br case 1:{cout"输入数据将使原来数据丢失,确定这样做吗?(y/n)"endl;brbool yn=0;char temp;brcintemp;brif(temp=='y') yn=1;brif(yn){cout"请输入学生数目:";br cinstunum;br input(S,stunum);brofstream outfile("stunum.txt");broutfilestunum;broutfile.close();break;}}

case 2:display(S,stunum);break;

case 3:

{int cchoose;cout"1.修改信息"endl;br cout"2.添加信息"endl;cout"3.删除信息"endl;cout"请输入要执行的任务:"endl;br cincchoose;br switch(cchoose)br {case 1:{cout"请输入修改的信息人名"endl;cinname;change(S,name,stunum);break;}

case 2:{int ad;cout"请输入添加人数:";cinad;add(S,stunum,ad);break;}

case 3:{cout"请输入删除信息的人名"endl;cinname;del(S,name,stunum);break;}

break;}break;}

case 4:{cout"请输入学号:";br int cchoose;cincchoose;search(S,0,stunum,cchoose);br break;}

case 5:{ifstream infile("stuinfor.txt",ios::in);br for(int i=0;istunum;i++)br infileS[i].nameS[i].numS[i].dormin;br qsort(S,0,stunum-1);br ofstream outfile("sorted_infor.txt");br for(int i=0;istunum;i++) {outfileS[i].name' 'S[i].num' 'S[i].dorminendl;br coutS[i].name' 'S[i].num' 'S[i].dorminendl;}

outfile.close();infile.close();break;}

case 6:cout" 谢谢使用!"endl;exit(1);}

}

ofstream outfile("stunum.txt");

outfilestunum;

outfile.close();

return 0;

}

void input(student *stu,int all)

{ofstream outfile("stuinfor.txt");brfor(int i=0;iall;i++)br{cout"请输入第"i+1"个学生的姓名 学号 宿舍号:";br cinstu[i].namestu[i].numstu[i].dormin;br outfilestu[i].name" "stu[i].num" "stu[i].dorminendl;br}

outfile.close();

}

void display(student *stu,int all)

{

ifstream infile("stuinfor.txt",ios::in);

if(!infile) cerr"文件打开失败!"endl;

else{

for(int i=0;iall;i++)

{cout"输入的第"i+1"个学生的姓名 学号 宿舍号分别为:";br infilestu[i].namestu[i].numstu[i].dormin;br coutstu[i].name" "stu[i].num" "stu[i].dorminendl;br}

infile.close();}

}

void add(student *stu,int all,int add)

{

ofstream outfile("stuinfor.txt",ios::app);

for(int i=0;iadd;i++)

{

cout"请输入第"all+i+1"个学生的姓名 学号 宿舍号:";

cinstu[all+i].namestu[all+i].numstu[all+i].dormin;

outfilestu[all+i].name" "stu[all+i].num" "stu[all+i].dorminendl;

}

all+=add;

outfile.close();

}

//快速排序

int partition(student *a,int low,int high)

{

student tem;int piv=a[low].num;

while(highlow)

{

while(highlowa[high].num=piv) high--;

tem=a[high];a[high]=a[low];a[low]=tem;

while(highlowa[low].num=piv) low++;

tem=a[high];a[high]=a[low];a[low]=tem;

}

return low;

}

void qsort(student *a,int low,int high)

{int pivotloc;brif(lowhigh)br{br pivotloc=partition(a,low,high);br qsort(a,low,pivotloc-1);br qsort(a,pivotloc+1,high);br}

}

void del(student *stu,char *name,int num)

{int delper;char check;brifstream infile("stuinfor.txt");br for(int i=0;inum;i++) br {br infilestu[i].namestu[i].numstu[i].dormin;br if(strcmp(name,stu[i].name)==0) delper=i;}

cout"您要删除的信息如下:"endl;

coutstu[delper].name" "stu[delper].num" "stu[delper].dorminendl;

cout"您确定要删除吗?(y/n)"endl;

cincheck;

ofstream outfile("stuinfor.txt");

if(check=='y'||'Y')

{

for(int i=delper;inum;i++) stu[i]=stu[i+1];

num--;

for(int i=0;inum;i++) outfilestu[i].name" "stu[i].num" "stu[i].dorminendl;

cout"信息已删除!"endl;}

infile.close();

outfile.close();

}

void change(student *stu,char *name,int num)

{int change;char check,nam[10];brint cn,cd;brifstream infile("stuinfor.txt");br for(int i=0;inum;i++) br {br infilestu[i].namestu[i].numstu[i].dormin;br if(strcmp(name,stu[i].name)==0) change=i;br }

cout"您要修改的信息如下:"endl;

coutstu[change].name" "stu[change].num" "stu[change].dorminendl;

cout"您确定要修改吗?(y/n)"endl;

cincheck;

ofstream outfile("stuinfor.txt");

if(check=='y'||'Y')

{

cout"请依次输入姓名 学号 宿舍号"endl;

cinnamcncd;

strcpy(stu[change].name,nam);stu[change].num=cn;stu[change].dormin=cd;

for(int i=0;inum;i++)

outfilestu[i].name" "stu[i].num" "stu[i].dorminendl;

cout"信息已修改!"endl;}

infile.close();

outfile.close();}void search(student *stu,int low,int high,int check)

{int mid=(low+high)/2;brifstream infile("sorted_infor.txt");brif(!infile) cerr"文件打开失败!"endl;brelse br{for(int i=0;ihigh;i++) infilestu[i].namestu[i].numstu[i].dormin;brwhile(stu[mid].num!=checkhigh=low) {mid=(low+high)/2;if(stu[mid].numcheck) high=mid-1;brelse low=mid+1;}//折半查找

}

if(stu[mid].num==check)

{cout"您要查询的信息如下:"endl;brcoutstu[mid].name" "stu[mid].num" "stu[mid].dorminendl;}

else cout"未能查到您所要查询信息!"endl;

}

谁知道哪里有免费的学生寝室管理系统源代码下载 ?

西财经大学学生宿舍管理系统

慧博学生宿舍管理系统 6.82

适用于大中专院校的学生宿舍管理系统,类别JSPServlet

SQL server版本

关于学生宿舍管理系统源代码和学生宿舍管理系统源代码JAVA的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/13934.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载