b2c信息网

您现在的位置是:首页 > 今日新闻 > 正文

今日新闻

ssm校园宿舍管理系统源码(基于ssm的学生信息管理系统)

hacker2022-07-07 06:32:20今日新闻87
本文目录一览:1、求学生宿舍管理系统源代码?2、

本文目录一览:

求学生宿舍管理系统 源代码?

/* Note:Your choice is C IDE */

#includestdio.h

#includemalloc.h

#define LEN sizeof(struct student)

int m;

struct student

{

long num;

char name[20];

char addr[30];

char xueli[20];

struct student *next;

};

void main()

{

int n,w;

struct student *head=0;

void print(struct student *head);

struct student *creat();

struct student *add(struct student *head);

struct student *del(struct student *head);

struct student *search(struct student *head);

system("cls");

do

{

printf("\t\t*******************************************\n");

printf("\t\t*** Student Information Management System***\n");

printf("\t\t********************************************\n");

printf("\t\t**** choose ********************\n");

printf("\t\t**** 1 Enter new data *************\n");

printf("\t\t**** 2 Modify data **************\n");

printf("\t\t**** 3 Search by people .xueli and num ****\n");

printf("\t\t**** 4 Browse data *****************\n");

printf("\t\t**** 5 add data ************\n");

printf("\t\t**** 6 Exit *************\n");

printf("\t\t******************************************\n");

printf("\t\t*******************************************\n");

printf("choose your number(1-6):[ ]\b\b");

do

{

scanf("%d",n);

if(n6||n1)

{

w=1;

printf("Error,please input again(1-6):");

}

else w=0;

}while(w==1);

switch(n)

{

case 1:head=creat();break;

case 2:del(head);break;

case 3:search(head);break;

case 4:print(head);break;

case 5:add(head);break;

case 6:exit(0);

}

}while(n!=6);

}

struct student *creat()

{

struct student *head;

struct student *p1,*p2;

m=0;

p1=p2=(struct student *)malloc(LEN);

printf("Please input number:");

scanf("%ld",p1-num);

printf("Please input name:");

scanf("%s",p1-name);

printf("address:");

scanf("%s",p1-addr);

printf("xueli:");

scanf("%s",p1-xueli);

while(p1-num!=0)

{

m=m+1;

if(m==1)head=p1;

else p2-next=p1;

p2=p1;

p1=(struct student *)malloc(LEN);

printf("number:");

scanf("%ld",p1-num);

printf("name:");

scanf("%s",p1-name);

printf("address:");

scanf("%s",p1-addr);

printf("xueli:");

scanf("%s",p1-xueli);

}

p2-next=0;

print(head);

return(head);

}

struct student *del(struct student *head)

{

long num;

struct student *p1,*p2;

if(head==0)

{

printf("\nlist null\n");

exit(0);

}

p1=head;

printf("Which number do you want del:");

scanf("%ld",num);

while(num!=p1-nump1-next!=0)

{

p2=p1;

p1=p1-next;

}

if(num==p1-num)

{

if(p1==head)head=p1-next;

else p2-next=p1-next;

printf("delete:%ld\n",num);

m=m-1;

}

else printf("%ld not been found!\n",num);

print(head);

return(head);

}

struct student * add(struct student * head)

{

struct student *p0,*p1,*p2;

p0=(struct student *)malloc(LEN);

printf("number:");

scanf("%ld",p0-num);

printf("name:");

scanf("%s",p0-name);

printf("address:");

scanf("%s",p0-addr);

printf("xueli:");

scanf("%s",p0-xueli);

p1=head;

if(head==0)

{

head=p0;

p0-next=0;

}

else

{

while((p0-nump1-num)(p1-next!=0))

{

p2=p1;

p1=p1-next;

}

if(p0-num=p1-num)

{

if(head==p1)head=p0;

else p2-next=p0;

p0-next=p1;

}

else

{

p1-next=p0;

p0-next=0;

}

}

m=m+1;

print(head);

}

void print(struct student *head)

{

struct student *p;

printf("\nNow,There %d records are:\n",m);

p=head;

if(head!=0)

do

{

printf("%ld\t",p-num);

printf("%s\t",p-name);

printf("%s\t",p-addr);

printf("%s\n",p-xueli);

p=p-next;

}while(p!=0);

}

struct student *search(struct student *head)

{

int n,w;

struct student *name(struct student *head);

struct student *number(struct student *head);

struct student *xueli(struct student *head);

printf("***** 7 use name to search****\n");

printf("***** 8 use number to search****\n");

printf("***** 9 use xueli to search****\n");

printf("choose your number[ ]\b\b");

do

{

scanf("%d",n);

if(n9||n7)

{

w=1;

printf("error,please input again:");

}

else w=0;

}while(w==1);

switch(n)

{

case 7:name(head);break;

case 8:number(head);break;

case 9:xueli(head);break;

}

}

struct student *name(struct student *head)

{

char nam[20];

int w;

struct student *p1;

printf("Please input name:");

scanf("%s",nam);

if(head==0)

{

printf("\nlist null\n");

exit(0);

}

p1=head;

while(strcmp(nam,p1-name)!=0p1-next!=0)

{

p1=p1-next;

w=0;

}

if(strcmp(nam,p1-name)==0)

{

printf("%ld\t%s\t%s\t%s\n",p1-num,p1-name,p1-addr,p1-xueli);

w=1;

}

if(w==0)printf("%s not been found!\n",nam);

}

struct student *number(struct student *head)

{

long num;

int w=0;

struct student *p1;

printf("please input the number:");

scanf("%ld",num);

if(head==0)

{

printf("\nlist null!\n");

exit(0);

}

p1=head;

while(p1-next!=0)

{

if(num==p1-num)

{

w=1;

printf("%ld\t%s\t%s\t%s\n",p1-num,p1-name,p1-addr,p1-xueli);

}

p1=p1-next;

}

if(w==0)printf("%ld not been found!\n",num);

}

struct student *xueli(struct student *head)

{

struct student *p1;

char xue[20];

int w=0;

if(head==0)

{

printf("\nlist null\n");

exit(0);

}

printf("please input xueli:");

scanf("%s",xue);

p1=head;

while(p1-next!=0)

{

if(strcmp(xue,p1-xueli)==0)

{

printf("%ld\t%s\t%s\t%s\n",p1-num,p1-name,p1-addr,p1-xueli);

w=1;

}

p1=p1-next;

}

if(w==0)printf("%s not been found\n",xue);

}

有没有谁有用ssm框架做的学生宿舍管理系统

ssm是个啥玩意儿?我之前倒是用蓝点通用管理系统做过类似的系统,你可以参考下。

学生宿舍管理系统,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;

}

发表评论

评论列表

  • 澄萌戏侃(2022-07-07 15:25:04)回复取消回复

    cin stu_num; } file1.open("c:\\stu.dat",ios::in | ios::binary | ios::beg);//按读方式打开文件 while(!file1.eof()) {

  • 世味烟柳(2022-07-07 12:04:43)回复取消回复

    ; if(n==sizeof(student)) { s1.Show(); flags=1; }

  • 鸠骨蒗幽(2022-07-07 15:10:59)回复取消回复

    本文目录一览:1、求学生宿舍管理系统 源代码?2、有没有谁有用ssm框架做的学生宿舍管理系统3、学生宿舍管理系统,C++源码求学生宿舍管理系统 源代码?[editor-custom-image-flag]/* Not

  • 痛言释欢(2022-07-07 16:12:21)回复取消回复

    house_name "的学生记录!" endl; flags=0; break; case '4': //按姓名查找 cout"请输入学生姓名:"; cinstu_name; file