信息登記源碼
㈠ 學生信息管理系統最簡單源代碼。
方法一:
1、創建一個c語言項目。然後右鍵頭文件,創建一個Stu的頭文件。
㈡ C# windowform程序,求源代碼。 1.計算電費 2.信息登記
//你們哪裡學校,怎麼也有這道題,我寫給你第二題
//學生類
namespaceStudentStatistics
{
classStudent
{
privatestringname;
privatestringsex;
privateintage;
privatestaticintid=1001;
publicstringName{get=>name;set=>name=value;}
publicstringSex{get=>sex;set=>sex=value;}
publicintAge{get=>age;set=>age=value;}
publicStudent(stringname,stringsex,intage)
{
this.name=name;
this.sex=sex;
this.age=age;
id++;
}
}
}
//主窗體
usingSystem;
usingSystem.Windows.Forms;
namespaceStudentStatistics
{
publicpartialclassForm1:Form
{
publicForm1()
{
InitializeComponent();
}
privatevoidbtn_ok_Click(objectsender,EventArgse)
{
if(tbx_name.TextLength<2)
{
PrintMsg("姓名必須不少於兩個漢字!");
return;
}
if(!(tbx_sex.Text=="男"||tbx_sex.Text=="女"))
{
PrintMsg("性別為"男"或"女"!");
return;
}
intage=0;
boolbl=int.TryParse(tbx_age.Text,outage);
if(!bl||age==0||age>=120)
{
PrintMsg("年齡輸入有誤");
return;
}
Studentstu=newStudent(tbx_name.Text,tbx_sex.Text,age);
PrintMsg("該學生信息創建成功!");
tbx_name.Clear();
tbx_sex.Clear();
tbx_age.Clear();
}
privatevoidPrintMsg(stringstr)
{
MessageBox.Show(str);
}
}
}
//第一題做出來要半個小時,其實邏輯挺簡單的,其實就是幾個分歧
㈢ 學生基本信息管理系統C++源代碼
#include<iostream>
#include<iomanip>
#include<string>
usingnamespacestd;
typedefstructstudent{
unsignedm_id;
stringm_name;
unsignedm_age;
stringm_sex;
stringm_address;
stringm_contact;
stringm_dormitory;
structstudent*m_next;
}student;
classCStudent{
private:
student*head;
public:
CStudent(){
head=newstudent;
head->m_id=0;
head->m_name="noname";
head->m_next=NULL;
}
~CStudent(){
student*p=head,*q;
while(p){
q=p;
p=q->m_next;
deleteq;
}
}
studentreaddata(intmodel);//model=1:不讀取學號,2:不讀取姓名,其他,讀取所有信息
voidentering();
boolinsert(conststudent&astu);
student*findid(unsignedid)const;
student*findname(conststring&name)const;
student*findsex(conststring&sex)const;
student*finddormitory(conststring&dormitory)const;
unsignedboys()const;
unsignedgirls()const;
unsignedheadcount()const;
booleraseid();
boolerasename();
boolmodifyid();
boolmodifyname();
voidShow()const;
voidquery()const;
voidfriendstatistics(constCStudent&aclss);
voidfrienderase(CStudent&aclss);
voidfriendmodify(CStudent&aclss);
};
stringreadstring(){
stringstr;
while(cin.get()!=' ');
cin>>str;
returnstr;
}
studentCStudent::readdata(intmodel){
studenttmp;
if(model!=1){cout<<"學號:";cin>>tmp.m_id;}
if(model!=2){cout<<"姓名:";tmp.m_name=readstring();}
cin>>tmp.m_age;
cout<<"性別:";
tmp.m_sex=readstring();
cout<<"住址:";
tmp.m_address=readstring();
cout<<"聯系方式:";
tmp.m_contact=readstring();
cout<<"寢室:";
tmp.m_dormitory=readstring();
returntmp;
}
voidCStudent::entering(){
studenttmp;
cout<<"學號(0toreturn):";
cin>>tmp.m_id;
while(tmp.m_id){
if(findid(tmp.m_id)==NULL){
cout<<"姓名:";
tmp.m_name=readstring();
cout<<"年齡:";
cin>>tmp.m_age;
cout<<"性別:";
tmp.m_sex=readstring();
cout<<"住址:";
tmp.m_address=readstring();
cout<<"聯系方式:";
tmp.m_contact=readstring();
cout<<"寢室:";
tmp.m_dormitory=readstring();
insert(tmp);
}
elsecout<<"重復的學號:"<<tmp.m_id<<endl;
cout<<"學號(0toreturn):";
cin>>tmp.m_id;
}
}
student*CStudent::findid(unsignedid)const{
student*p;
for(p=head;p->m_next;p=p->m_next)
if(p->m_next->m_id==id)returnp;
returnNULL;
}
student*CStudent::findname(conststring&name)const{
student*p;
for(p=head;p->m_next;p=p->m_next)
if(p->m_next->m_name==name)returnp;
returnNULL;
}
student*CStudent::findsex(conststring&sex)const{
student*p;
for(p=head;p->m_next;p=p->m_next)
if(p->m_next->m_sex==sex)returnp;
returnNULL;
}
student*CStudent::finddormitory(conststring&dormitory)const{
student*p;
for(p=head;p->m_next;p=p->m_next)
if(p->m_next->m_dormitory==dormitory)returnp;
returnNULL;
}
boolCStudent::insert(conststudent&astu){
student*newnode,*p=head;
if(p->m_next==NULL){
p->m_next=newstudent(astu);
p->m_next->m_next=NULL;
returntrue;
}
while(p->m_next){
if(p->m_next->m_id==astu.m_id){
cout<<"重復的學號,插入失敗! ";
returnfalse;
}
if(p->m_next->m_id>astu.m_id){
newnode=newstudent(astu);
newnode->m_next=p->m_next;
p->m_next=newnode;
returntrue;
}
p=p->m_next;
}
p->m_next=newstudent(astu);
p->m_next->m_next=NULL;
returntrue;
}
unsignedCStudent::boys()const{
unsignedcnt=0;
student*p;
for(p=head->m_next;p;p=p->m_next)
if(p->m_sex=="男")++cnt;
returncnt;
}
unsignedCStudent::girls()const{
unsignedcnt=0;
student*p;
for(p=head->m_next;p;p=p->m_next)
if(p->m_sex=="女")++cnt;
returncnt;
}
unsignedCStudent::headcount()const{
unsignedcnt=0;
student*p;
for(p=head->m_next;p;p=p->m_next,++cnt);
returncnt;
}
boolCStudent::eraseid(){
student*q,*p;
unsignedid;
cout<<"輸入要刪除的學號:";
cin>>id;
p=findid(id);
if(p==NULL){
cout<<"沒有找到學號是""<<id<<""的學生,刪除失敗! ";
returnfalse;
}
q=p->m_next;
p->m_next=q->m_next;
deleteq;
returntrue;
}
boolCStudent::erasename(){
student*q,*p;
stringname;
cout<<"輸入要刪除人的姓名:";
name=readstring();
p=findname(name);
if(p==NULL){
cout<<"沒有找到姓名是""<<name<<""的學生,刪除失敗! ";
returnfalse;
}
q=p->m_next;
p->m_next=q->m_next;
deleteq;
returntrue;
}
boolCStudent::modifyid(){
studenttmp,*p;
unsignedid;
cout<<"輸入要修改的學號:";
cin>>id;
p=findid(id);
if(p==NULL){
cout<<"沒有找到學號是""<<id<<""的學生,修改失敗! ";
returnfalse;
}
tmp=readdata(1);
tmp.m_id=id;
*p=tmp;
returntrue;
}
boolCStudent::modifyname(){
student*p,tmp;
stringname;
cout<<"輸入要修改人的姓名:";
name=readstring();
p=findname(name);
if(p==NULL){
cout<<"沒有找到姓名是""<<name<<""的學生,修改失敗! ";
returnfalse;
}
tmp=readdata(2);
tmp.m_name=name;
*p=tmp;
returntrue;
}
intmenu(){
intchoice;
do{
system("cls");
cout<<" **************************** ";
cout<<" *學生基本信息管理系統* ";
cout<<" *==========================* ";
cout<<" *1、錄入學生信息* ";
cout<<" *2、顯示學生信息* ";
cout<<" *3、查詢學生信息* ";
cout<<" *4、添加學生信息* ";
cout<<" *5、統計學生信息* ";
cout<<" *6、刪除學生信息* ";
cout<<" *7、修改學生信息* ";
cout<<" *0、退出管理系統* ";
cout<<" **************************** ";
cout<<" 請選擇:";
cin>>choice;
}while(choice<0||choice>7);
returnchoice;
}
voidshow(student*p){
cout<<p->m_id<<""<<p->m_name<<""<<p->m_age<<"";
cout<<p->m_sex<<""<<p->m_address<<"";
cout<<p->m_contact<<""<<p->m_dormitory<<endl;
}
voidCStudent::Show()const{
student*p;
cout<<"---------------------------------------------------------- ";
for(p=head->m_next;p;p=p->m_next)show(p);
cout<<"---------------------------------------------------------- ";
system("pause");
}
voidCStudent::query()const{
intselect;
unsignedid;
stringname;
student*p;
cout<<"1、按學號查詢 2、按姓名查詢 0、返回 ";
cin>>select;
switch(select){
case1:cout<<"請輸入學號:";cin>>id;
if(p=findid(id))show(p->m_next);
break;
case2:cout<<"請輸入姓名:";name=readstring();
if(p=findname(name))show(p->m_next);
break;
case0:return;
default:cout<<"選擇錯誤。 ";
}
system("pause");
}
voidstatistics(constCStudent&a){
unsignedtotal=a.headcount();
unsignedboys=a.boys();
unsignedgirls=a.girls();
cout<<"學生總數:"<<total<<"人。 ";
cout<<"其中,男生:"<<boys<<"名。";
cout<<"女生:"<<girls<<"名。 ";
system("pause");
}
voiderase(CStudent&a){
intselect;
unsignedid;
stringname;
student*p,*q;
cout<<"1、按學號刪除 2、按姓名刪除 0、返回 ";
cin>>select;
switch(select){
case1:cout<<"請輸入學號:";cin>>id;
if(p=a.findid(id)){
q=p->m_next;
p->m_next=q->m_next;
deleteq;
cout<<"成功刪除"<<id<<"的信息。 ";
}
break;
case2:cout<<"請輸入姓名:";name=readstring();
if(p=a.findname(name)){
q=p->m_next;
p->m_next=q->m_next;
deleteq;
cout<<"成功刪除"<<name<<"的信息。 ";
}
break;
case0:return;
default:cout<<"選擇錯誤。 ";
}
system("pause");
}
voidmodify(CStudent&a){
intselect;
cout<<"1、按學號修改 2、按姓名修改 0、返回 ";
cin>>select;
switch(select){
case1:if(a.modifyid())cout<<"修改成功。 ";break;
case2:if(a.modifyname())cout<<"修改成功。 ";break;
case0:return;
default:cout<<"選擇錯誤。 ";
}
system("pause");
}
intmain(){
CStudenta;
intan;
do{
an=menu();
switch(an){
case1:a.entering();break;
case2:a.Show();break;
case3:a.query();break;
case4:a.entering();break;
case5:statistics(a);break;
case6:erase(a);break;
case7:modify(a);break;
case0:break;
default:cout<<"選擇錯誤。 ";break;
}
}while(an);
return0;
}
use master
go
if exists (select * from dbo.sysdatabases where name = 'Student')
drop database Student
GO
create database Student
go
use Student
go
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[user_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[user_Info]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[student_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[student_Info]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[result_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[result_Info]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[gradecourse_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[gradecourse_Info]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[course_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[course_Info]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[class_Info]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[class_Info]
GO
CREATE TABLE [dbo].[user_Info] (
[user_ID] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[user_PWD] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[user_Des] [char] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[student_Info] (
[student_ID] [int] NOT NULL ,
[student_Name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[student_Sex] [char] (2) COLLATE Chinese_PRC_CI_AS NULL ,
[born_Date] [datetime] NULL ,
[class_NO] [int] NULL ,
[tele_Number] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[ru_Date] [datetime] NULL ,
[address] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[comment] [varchar] (200) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[result_Info] (
[exam_No] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[student_ID] [int] NOT NULL ,
[student_Name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[class_No] [int] NULL ,
[course_Name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[result] [float] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[gradecourse_Info] (
[grade] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[course_Name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[course_Info] (
[course_No] [int] NOT NULL ,
[course_Name] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[course_Type] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[course_Des] [char] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[class_Info] (
[class_No] [int] NOT NULL ,
[grade] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[director] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[classroom_No] [char] (10) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
㈤ 簡單的JAVA員工信息管理系統源碼怎麼做
1)每個員工的信息包括:編號、姓名、性別、出生年月、學歷、職務、電話、住址等。
(2)系統的功能包括:
(a)查詢:按特定條件查找員工。
(b)修改:按編號對某個員工的某項信息進行修改。
(c)插入:加入新員工的信息。
(d)刪除:按編號刪除已離職員工的信息。
(e)排序:按特定條件對所有員工的信息進行排序。
㈥ 學生信息管理系統C++源代碼
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<malloc.h>
#define INIT_SIZE 10
#define INCRE_SIZE 10
#define SUBJECT_NUM 3
#define LEN 3
void show_Start();
void show_Table();
void addRecord();
void Info_delete();
void deleteRecord();
void delete_Num(int);
void delete_Name(char tarName[]);
void Info_modify();
void modifyRecord();
void modify_Num(int);
void modify_Name(char[]);
void Info_query();
void queryRecord();
void query_Num(int);
void query_Name(char[]);
void display();
void quit();
void menu_CMD();
char *subject[SUBJECT_NUM] = {"高代","數分","C語言"};
struct STUDENT
{
int num;
char name[20];
char sex;
float score[SUBJECT_NUM];
};
//struct STUDENT stu[LEN + 1];
//STUDENT *record = (STUDENT*)malloc(sizeof(STUDENT)*INIT_SIZE);
int static stuNum = 0;
//先暫時定義三個學生吧...
STUDENT *record = (STUDENT*)malloc(sizeof(STUDENT)*INIT_SIZE);;
int main()
{
//record = (STUDENT*)malloc(sizeof(STUDENT)*INIT_SIZE);
//STUDENT *record = (STUDENT*)malloc(sizeof(STUDENT)*INIT_SIZE);
/*
record[1].num = 1001;
strcpy(record[1].name,"Jason");
record[1].sex = 'M';
record[1].score[0] = 85.0;
record[1].score[1] = 90.0;
record[1].score[2] = 95.0;
record[2].num = 1002;
strcpy(record[2].name,"Jerry");
record[2].sex = 'M';
record[2].score[0] = 85.0;
record[2].score[1] = 90.0;
record[2].score[2] = 95.0;
record[3].num = 1003;
strcpy(record[3].name,"Jessie");
record[3].sex = 'F';
record[3].score[0] = 85.0;
record[3].score[1] = 90.0;
record[3].score[2] = 95.0;
*/
/*
Info_modify();
int key;
cout<<"請輸入您的選擇 : ";
cin>>key;
if(key == 1)
{
int targetNum;
cout<<"請輸入您欲修改的學生的學號 : ";
cin>>targetNum;
modify_Num(targetNum);
cout<<endl;
display();
}
if(key == 2)
{
char targetName[20];
cout<<"請輸入您欲修改學生的姓名 : ";
cin>>targetName;
modify_Name(targetName);
cout<<endl;
display();
}
if(key == 3)
{
exit(0);
}
*/
show_Start();
menu_CMD();
return 0;
}
//修改完後還應該顯示
void show_Start()
{
//cout<<endl;
cout<<" **************************************** "<<endl;
cout<<" 這是一個 "<<endl;
cout<<" 學生成績管理系統 "<<endl;
cout<<" 可以對學生成績進行管理 "<<endl;
cout<<" 歡迎大家使用 "<<endl;
cout<<" Made by Jason "<<endl;
cout<<" **************************************** "<<endl;
}
// 顯示表頭信息,即是 : 學號,姓名,性別,高代,數分,C語言.
void show_Table()
{
cout<<"學號"<<"\t"<<"姓名"<<"\t"<<"性別";
cout<<"\t"<<subject[0]<<"\t"<<subject[1]<<"\t"<<subject[2];
cout<<endl;
}
void menu_CMD()
{
int key;
while(1)
{
cout<<"1. 增加學生信息"<<endl;
cout<<"2. 刪除學生信息"<<endl;
cout<<"3. 修改學生信息"<<endl;
cout<<"4. 查詢學生信息"<<endl;
cout<<"5. 顯示學生信息"<<endl;
cout<<"6. 退出"<<endl;
cout<<"請輸入您的選擇 : ";
cin>>key;
while(1)
{
if((key < 1)||(key > 6))
{
int key;
cout<<"您的輸入有誤,請重新輸入!"<<endl;
cout<<"請選(1 - 5) : ";
cin>>key;
}
else
{
break;
}
}
switch(key)
{
case 1:
addRecord();
break;
case 2:
deleteRecord();
break;
case 3:
modifyRecord();
break;
case 4:
queryRecord();
break;
case 5:
display();
break;
case 6:
quit();
break;
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//增加學生信息
void addRecord()
{
if(stuNum == 0)
{
cout<<"原來沒有記錄,現在建立新表!"<<endl;
stuNum++;
}
else
{
cout<<"現在在當前表的末尾添加新的信息!"<<endl;
stuNum++;
}
//如果數組空間不夠,重新申請空間
if(stuNum > INIT_SIZE)
{
cout<<"內存空間不夠,現在重新申請新的內存空間!"<<endl;
record = (STUDENT*)realloc(record,(INIT_SIZE + INCRE_SIZE)*sizeof(STUDENT));
cout<<"空間申請完成!"<<endl;
}
cout<<"您現在要添加一組新的信息,您確定嗎?"<<endl;
cout<<"請輸入您的選擇(Y/N) : ";
char choi;
cin>>choi;
if((choi == 'Y')||(choi == 'y'))
{
cout<<"請輸入學號 : ";
cin>>record[stuNum].num;
cout<<"請輸入姓名 : ";
cin>>record[stuNum].name;
cout<<"請輸入性別(M為男,F為女) : ";
cin>>record[stuNum].sex;
int i;
for(i = 0;i < SUBJECT_NUM;i++)
{
cout<<"請輸入"<<subject[i]<<"的成績 : ";
cin>>record[stuNum].score[i];
}
}
if((choi == 'N')||(choi == 'n'))
{
cout<<"退出添加新學生信息!"<<endl;
cout<<endl;
}
cout<<"現在已經有"<<stuNum<<"條學生的信息了!"<<endl;
cout<<endl;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//刪除信息 晚上完成...
//顯示deleteRecord的表頭信息
void Info_delete()
{
cout<<"請輸入刪除方式 : "<<endl;
cout<<"1. 按學號刪除"<<endl;
cout<<"2. 按姓名刪除"<<endl;
cout<<"3. 退出刪除"<<endl;
}
//刪除學生的信息,包含兩個子函數
void deleteRecord()
{
int key;
cout<<endl;
Info_delete();
cout<<"請輸入您的選擇 : ";
cin>>key;
if(key == 1)
{
int targetNum;
cout<<"請輸入您欲刪除學生的學號 : ";
cin>>targetNum;
//按學號刪除
delete_Num(targetNum);
cout<<endl;
}
if(key == 2)
{
char targetName[20];
cout<<"請輸入您欲刪除學生的姓名 : ";
cin>>targetName;
//按姓名刪除
delete_Name(targetName);
cout<<endl;
}
if(key == 3)
{
while(1)
{
menu_CMD();
}
}
}
//按學號刪除學生信息
//只用完成刪除操作,而不必輸出. 輸出的操作可以在主菜單中進行
void delete_Num(int tarNum)
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(record[i].num == tarNum)
{
//刪除還要分兩種情況討論
//1. 欲刪除的學生信息是最後一位
//2. 欲刪除的學生信息不是最後一位
//第一種情況,欲刪除的學生是最後一位
if(i = stuNum)
{
cout<<"您所要刪除的學生信息是 : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<record[i].score[1]<<"\t"<<record[i].score[2];
cout<<endl;
cout<<endl<<"刪除後學生信息表為 : "<<endl;
show_Table();
for(int i = 1;i <= stuNum - 1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
//顯示信息應該放在後面
/*
stuNum--;
cout<<"現在還剩下"<<stuNum<<"條學生的信息";
cout<<endl;
*/
}
//2.第二種情況,欲刪除的學生不是最後一位
if(i != stuNum)
{
cout<<"您所要刪除的學生信信息是 : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score[2];
for(int j = i+1;j <= stuNum;j++)
{
record[j-1] = record[j];
}
//接著完成輸出
cout<<endl;
cout<<"刪除後學生信息表為 : "<<endl;
show_Table();
for(int i = 1;i <= stuNum-1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
/*
stuNum--;
cout<<"現在還剩下"<<stuNum<<"條學生的信息";
cout<<endl;
*/
}
stuNum--;
cout<<"現在還是剩下"<<stuNum<<"條學生的信息";
cout<<endl;
}
}
}
/*
//方法同上
void delete_Name(char tarName[])
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(strcmp(record[i].name,tarName) == 0)
{
//刪除還要分兩種情況討論
//1. 欲刪除的學生信息是最後一位
//2. 欲刪除的學生信息不是最後一位
//第一種情況 : 欲刪除學生是最後一位
if(i = stuNum)
{
cout<<"您所要刪除的學生信息是 : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<record[i].score[1]<<"\t"<<record[i].score[2];
cout<<endl;
cout<<endl<<"刪除後學生信息表為 : "<<endl;
show_Table();
for(int i = 1;i <= stuNum - 1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
}
//第二種情況 : 欲刪除學生不是最後一位
if(i != stuNum)
{
cout<<"您所要刪除的學生信信息是 : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score[2];
//整體往前 前移一位
for(int j = i+1;j <= stuNum;j++)
{
record[j-1] = record[j];
}
cout<<endl;
//接著完成輸出
cout<<"刪除後學生信息表為 : "<<endl;
show_Table();
for(int i = 1;i <= stuNum-1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
cout<<endl;
}
}
}
}
*/
void delete_Name(char tarName[])
{
int i;
for(i = 1;i <= stuNum;i++)
{
//刪除還要分兩種情況討論
//1. 欲刪除的學生信息是最後一位
//2. 欲刪除的學生信息不是最後一位
//當欲刪除的學生是最後一位,直接輸出前面LEN-1位學生的信息
if(strcmp(record[i].name,tarName) == 0)
{
if(i == stuNum)
{
cout<<"您所要刪除的學生信息是 : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t"
<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score[2];
cout<<endl;
cout<<"刪除後學生信息表為 : "<<endl;
show_Table();
for(int i = 1;i <= stuNum-1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
/*
stuNum--;
cout<<"現在還剩下"<<stuNum<<"條學生的信息";
cout<<endl;
*/
}
//當欲刪的學生不是最後一位,整體往前前移一位
if(i != stuNum)
{
cout<<"您所要刪除的學生信息是 : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex<<"\t";
cout<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score[2];
cout<<endl;
//整體往前前移一位
for(int j = i+1;j <= stuNum;j++)
{
record[j-1] = record[j];
}
//然後輸出
cout<<endl;
cout<<"刪除後學生信息表為 : "<<endl;
show_Table();
for(int i = 1;i <= stuNum-1;i++)
{
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(int j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
/*
stuNum--;
cout<<"現在還剩下"<<stuNum<<"條學生的信息";
cout<<endl;
*/
}
stuNum--;
cout<<"現在還剩下"<<stuNum<<"條學生的信息";
cout<<endl;
}
}
}
/*****************************************************************************
******************************************************************************/
//顯示modifyRecord的表頭信息
void Info_modify()
{
cout<<"請輸入修改方式 : "<<endl;
cout<<"1. 按學號修改"<<endl;
cout<<"2. 按姓名修改"<<endl;
cout<<"3. 退出修改"<<endl;
}
//查詢學生的成績,當然裡麵包括兩個子函數
void modifyRecord()
{
int key;
cout<<endl;
Info_modify();
cout<<"請輸入您的選擇 : ";
cin>>key;
//按學號修改
if(key == 1)
{
int targetNum;
cout<<"請輸入您欲修改的學生的學號 : ";
cin>>targetNum;
modify_Num(targetNum);
cout<<endl;
//display();
}
//按姓名修改
if(key == 2)
{
char targetName[20];
cout<<"請輸入您欲修改學生的姓名 : ";
cin>>targetName;
modify_Name(targetName);
cout<<endl;
//display();
}
//退出修改
if(key == 3)
{
while(1)
{
menu_CMD();
}
}
}
//按學號修改
void modify_Num(int tarNum)
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(record[i].num == tarNum)
{
cout<<endl<<"請修改該學生的信息"<<endl;
cout<<"請輸入該學生的學號 : ";
cin>>record[i].num;
cout<<"請輸入該學生的姓名 : ";
cin>>record[i].name;
cout<<"請輸入該學生的性別 : ";
cin>>record[i].sex;
cout<<"請輸入"<<subject[0]<<"的成績 : ";
cin>>record[i].score[0];
cout<<"請輸入"<<subject[1]<<"的成績 : ";
cin>>record[i].score[1];
cout<<"請輸入"<<subject[2]<<"的成績 : ";
cin>>record[i].score[2];
}
}
}
//按姓名修改
void modify_Name(char tarName[])
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(strcmp(record[i].name,tarName) == 0)
{
cout<<endl<<"請修改該學生的信息 : "<<endl;
cout<<"請輸入該學生的學號 : ";
cin>>record[i].num;
cout<<"請輸入該學生的姓名 : ";
cin>>record[i].name;
cout<<"請輸入該學生的性別 : ";
cin>>record[i].sex;
cout<<"請輸入"<<subject[0]<<"的成績 : ";
cin>>record[i].score[0];
cout<<"請輸入"<<subject[1]<<"的成績 : ";
cin>>record[i].score[1];
cout<<"請輸入"<<subject[2]<<"的成績 : ";
cin>>record[i].score[2];
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//顯示queryRecord的表頭信息
void Info_query()
{
cout<<"請輸入查詢方式 : "<<endl;
cout<<"1. 按學號查詢"<<endl;
cout<<"2. 按姓名查詢"<<endl;
cout<<"3. 退出查詢"<<endl;
}
//查詢學生信息queryRecord
void queryRecord()
{
int key;
cout<<endl;
Info_query();
cout<<"請輸入您的選擇 : ";
cin>>key;
if(key == 1)
{
int targetNum;
cout<<"請輸入您欲查詢學生的學號 : ";
cin>>targetNum;
query_Num(targetNum);
cout<<endl;
}
if(key == 2)
{
char targetName[20];
cout<<"請輸入您欲查詢學生的學號 : ";
cin>>targetName;
query_Name(targetName);
cout<<endl;
}
//退出查詢,退回到主菜單吧...
if(key == 3)
{
while(1)
{
menu_CMD();
}
}
}
//按學號查詢
void query_Num(int tarNum)
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(record[i].num == tarNum)
{
//如果表中有該學生信息的話,僅用輸出該學生的信息即可.
//輸出該學生的信息
cout<<"該學生的信息如下 : "<<endl;
//顯示表頭信息
show_Table();
//顯示該學生具體的信息
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
cout<<"\t"<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score[2];
cout<<endl;
}
}
}
//按姓名查詢
void query_Name(char tarName[])
{
int i;
for(i = 1;i <= stuNum;i++)
{
if(strcmp(record[i].name,tarName) == 0)
{
cout<<"該學生的信息如下 : "<<endl;
show_Table();
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
cout<<"\t"<<record[i].score[0]<<"\t"<<record[i].score[1]<<"\t"<<record[i].score[2];
cout<<endl;
}
}
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//先顯示所有學生的信息吧
//顯示record里所有學生的成績
void display()
{
show_Table();
int i,j;
for(i = 1;i <= stuNum;i++)
{
//cout<<"學號"<<"\t"<<"姓名"<<"\t"<<"性別";
cout<<record[i].num<<"\t"<<record[i].name<<"\t"<<record[i].sex;
for(j = 0;j < SUBJECT_NUM;j++)
{
cout<<"\t"<<record[i].score[j];
}
cout<<endl;
}
cout<<endl;
}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//退出
void quit()
{
char choi;
cout<<"您確定要退出嗎?"<<endl;
cout<<"請輸入您的選擇(Y/N) : ";
cin>>choi;
if((choi == 'Y')||(choi == 'y'))
{
cout<<"現在退出學生信息管理系統"<<endl;
exit(0);
}
//如果不是退出,則接著退回到主界面
else
{
cout<<endl;
menu_CMD();
}
}
這個是原創的... 在C-Free 4.0里跑過,可以正常運行
你可以試著跑一下,如果有什麼問題可以和我聯系
㈦ 學生信息管理系統,C++實現的源代碼
#include <iostream>
#include<fstream>
#include<string>
using namespace std;
class student
{
public:
void setdate();//錄入
void chazhao();//查找
void showdate();//輸出
//void change();//修改
void del();//刪除
private:
student *next,*head;
string name;
int age;
};
void student::setdate()
{
int n;
cout<<"請輸入所要錄入的學生人數:"<<endl;
cin>>n;
student *p,*s;
int i;
for(i=0;i<n;i++)
{
p=new student;
cout<<"分別輸入學生的年齡和姓名:";
cin>>p->age>>p->name;
if(i==0)
head=s=p;
else s->next=p;
p->next=NULL;
s=p;
}
ofstream fout("d://program//test.txt",ios::out);
if(!fout){cout<<"cannot open file.";}
for(i=0;i<n;i++)
{
fout<<head->age<<" "<<head->name<<endl;
head=head->next;
}
fout.close();
}
void student::showdate()
{
student *p;
ifstream fout1("d://program//test.txt",ios::in);
if(!fout1){cout<<"cannot open file.\n";exit(1);}
p=new student;
while(fout1.good())
{
fout1>>p->age>>p->name;
if(fout1.good())
cout<<p->age<<" "<<p->name<<endl;
}
fout1.close();
}
void student::chazhao()
{
string a;
int k=0;
cout<<"輸入你要查找的學生的姓名:\n";
cin>>a;
student *p;
ifstream fout1("d://program//test.txt",ios::in);
if(!fout1){cout<<"cannot open file.\n";exit(1);}
while(fout1.good())
{
p=new student;
fout1>>p->age>>p->name;
if(p->name==a)
{
cout<<p->age<<" "<<p->name<<endl;
k=1;
break;
}
}
if(k==0) cout<<"你所查找的學生不存在!!!\n";
fout1.close();
}
void student::del()
{
student *p,*op;
string namea;
cout<<"輸入你所要刪除的學生的姓名:\n";
cin>>namea;
ifstream fout("d://program//test.txt",ios::in);
if(!fout){cout<<"cannot open file.";}
while(fout.good())
{
p=new student;
int i=0;
fout>>p->age>>p->name;
if(p->name==namea&&i==0)
{
delete p;
break;
}
else if(p->name==namea&&i!=0)
{
op->next=p->next;
delete p;
break;
}
else
{
op=p;
p=p->next;
}
i++;
}
cout<<"刪除成功!!!\n";
fout.close();
}
int main()
{
student ixiang;
int m;
cout<<"-------------歡迎使用我的成績管理系統!\n";
cout<<"--------------------1.錄入學生信息\n";
cout<<"--------------------2.輸出學生信息\n";
cout<<"--------------------3.查找學生信息\n";
cout<<"--------------------4.刪除學生信息\n";
cout<<"--------------------5.退出系統\n";
cout<<"請選擇所要執行的操作(1~4):\n";
cin>>m;
switch(m)
{
case 1:ixiang.setdate();
case 3:ixiang.chazhao();
//case 3:ixiang.change();break;
case 4:ixiang.del();break;
case 2:ixiang.showdate();
case 5:break;
}
return 0;
}
/*void menu::shanchu() {
system("cls") ;
char ch[10] ;
cout<<"\n *** 刪除信息 ***\n"<<endl ;
cout<<"\n 請輸入要刪除人的姓名 : " ;
cin>>ch ;
addbook *p , *p1 ;
p1 = head ;
while( p1 )
{
// cout<<ch<<" "<<p1->name<<endl ; // 查找結點
if(strcmp( p1->name , ch ) == 0 )
break ;
else {
p = p1 ; // 標記相連結點位置,刪除後可連接
p1 = p1->next ;
}
}
if( p1!= NULL )
{ // 判斷結點是否為空
cout<<"所要刪除的名片的信息如下,請確認!:\n"<<endl ;
output(p1) ; // 函數輸出名片信息
cout<<"請再次確認是否刪除該信息!!!(Y/N) :" ;
char c[10] ;
while(1)
{
cin>>c ;
if( toupper(c[0]) == 'Y' && c[1]=='\0' )
{
if( p1 == head )
{ // 判斷是否是第一個結點
head = p1->next ;
delete p1 ;
}
else
{
p->next = p1->next ; // 已標記結點的連接
delete p1 ;
}
cout<<"\t\t *** 刪除成功 *** \t\t\n" ;
system("cls") ;
cout<<"\n\n\n\n\n" ;
cout<<"\t\t *** 是否繼續刪除 *** \t\t\n" ;
cout<<"*** 請確認(Y/N) :" ;
while(1)
{
cin>>c;
if( toupper(c[0]) == 'Y' && c[1]=='\0' )
shanchu() ;
else if( toupper(c[0]) == 'N' && c[1]=='\0' )
return ;
else cout<<"輸入錯誤 , 請重新輸入(Y/N) :" ;
}
}
else if( toupper(c[0]) == 'N' && c[1]=='\0' ) return ;
else cout<<"輸入錯誤 , 請重新輸入(Y/N) :" ;
}
}
else {
cout<<"\n\n\n未找到該信息!!!"<<endl ;
system("pause") ;
return ;
}
}
*/
㈧ 求c語言房屋中介系統源代碼
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#define ESC 27
#define NULL0
#define LEN sizeof(struct applicant)
#define LENB sizeof(struct job)
#define L sizeof(info1)
#define LB sizeof(info2)
int n,k;
char filename1[10];
char filename2[10];
struct applicant
{
long anum;
char aname[10];
char id[18];
char cert[20];
char rqurjob[20];
struct applicant * next1;
}applcnt[60],info1;
struct job
{
long jnum;
char jname[20];
int need;
struct job * next2;
}jb[100],info2;
/*------------color--------------*/
color()
{
int x1=20,y1=5,x2=60,y2=40,i;
clrscr();
textmode(3);
textbackground(2);
window(x1,y1,x2,y2);
for(i=1;i <=21;i++)
{
gotoxy(1,i);cprintf( " ");}
}
/*-------------menu-----------*/
menu()
{
char c;
color(); textcolor(19); gotoxy(17,3);cprintf( "MENU "); textcolor(4);
gotoxy(9,5);cprintf( "1 --input applicant record ");
gotoxy(9,6);cprintf( "2 --output applicant record ");
gotoxy(9,7);cprintf( "3 --delete applicant record ");
gotoxy(9,8);cprintf( "4 --insert applicant record ");
gotoxy(9,9);cprintf( "5 --search applicant record ");
gotoxy(9,10);cprintf( "6 --open applicant record ");
gotoxy(9,11);cprintf( "7 --input job record ");
gotoxy(9,12);cprintf( "8 --output job record ");
gotoxy(9,13);cprintf( "9 --delete job record ");
gotoxy(9,14);cprintf( "10 --search jobe record ");
gotoxy(9,17);cprintf( "0 --exit ");
gotoxy(15,20);cprintf( "Please Select: ");
c=getch();
if(ESC==c)exit(0);
return(c);
}
/*---------------create applicant information---------------*/
struct applicant * create1(void)
{
struct applicant * p1, * p2; struct applicant * head1;
struct applicant * load1(void);
struct applicant * arrange1(struct applicant * head1);
char c;
color();
n=0;
p1=p2=(struct applicant * )malloc(LEN);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Num: "); scanf( "%1d ",&p1-> anum);
if(p1-> anum==0){head1=NULL;goto end;}
gotoxy(5,7);cprintf( "Enter Name: "); scanf( "%s ",p1-> aname);
gotoxy(5,9);cprintf( "Enter Your ID Number: "); scanf( "%s ",p1-> id);
gotoxy(5,11);cprintf( "Enter Your Certification: "); scanf( "%s ",p1-> cert);
gotoxy(5,13);cprintf( "Enter Your Ideal Job: "); scanf( "%s ",p1-> rqurjob);
head1=NULL;
while(p1-> anum!=0)
{
n=n+1;
if(n==1)head1=p1;
else p2-> next1=p1;
p2=p1;
p1=(struct applicant *)malloc(LEN);
color();
textcolor(14);
gotoxy(6,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Num: "); scanf( "%1d ",&p1-> anum);
if(p1-> anum==0) goto end;
gotoxy(5,7);cprintf( "Enter Name: "); scanf( "%s ",p1-> aname);
gotoxy(5,9);cprintf( "Enter Your ID number: "); scanf( "%s ",p1-> id);
gotoxy(5,11);cprintf( "Enter Your Certification: "); scanf( "%s ",p1-> cert);
gotoxy(5,13);cprintf( "Enter Your Ideal Job: "); scanf( "%s ",p1-> rqurjob);
}
end:p2-> next1=NULL;
head1=arrange1(head1);
gotoxy(5,16);cprintf( "Save(Y.or,N)? ");
c=getch();
if(c== 'Y '||c== 'y ')save1(head1);
else head1=load1();
return(head1);
}
/*---------------------create job information----------------------*/
struct job *create2(void)
{
struct job * p3, * p4; struct job * head2;
struct job *load2(void);
struct job *arrange2(struct job * head2);
char d;
color();
k=0;
p3=p4=(struct job *)malloc(LENB);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Job Number: "); scanf( "%1d ",&p3-> jnum);
if(p3-> jnum==0){head2=NULL;goto end;}
gotoxy(5,7);cprintf( "Enter Job Name: "); scanf( "%s ",p3-> jname);
gotoxy(5,9);cprintf( "Enter The Amount Of The Job Needs: "); scanf( "%i ",p3-> need);
head2=NULL;
while(p3-> jnum!=0)
{
k=k+1;
if(k==1)head2=p3;
else p4-> next2=p3;
p4=p3;
p3=(struct job * )malloc(LENB);
color();
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Job Number: "); scanf( "%1d ",&p3-> jnum);
if(p3-> jnum==0) goto end;
gotoxy(5,7);cprintf( "Enter Job Name: "); scanf( "%s ",p3-> jname);
gotoxy(5,9);cprintf( "Enter The Amount Of The Job Needs: "); scanf( "%i ",p3-> need);
}
end:p4-> next2=NULL;
head2=arrange2(head2);
gotoxy(5,12);cprintf( "Save(Y.Or,N)? ");
d=getch();
if(d== 'Y '||d== 'y ')save2(head2);
else head2=load2();
return(head2);
}
/*--------------print applicant information----------------*/
void print1(struct applicant * head1)
{
struct applicant * p5;int i=0;
color();textcolor(14);
p5=head1; textcolor(4);
if(head1-> anum==0)
{ gotoxy(4,4);cprintf( "NO info. of applicant! "); }
else
{
gotoxy(2,2);cprintf( "Number of Records:%d ",n);
textcolor(0);
gotoxy(5,4);cprintf( "Num Name ID Certification Required job ");
if(head1!=NULL)textcolor(1);
do{
gotoxy(5,5+i);cprintf( "%1d ",p5-> anum);
gotoxy(18,5+i);cprintf( "%s ",p5-> aname);
gotoxy(32,5+i);cprintf( "%s ",p5-> id);
gotoxy(50,5+i);cprintf( "%s ",p5-> cert);
gotoxy(75,5+i);cprintf( "%s ",p5-> rqurjob);
i++;
p5=p5-> next1;
}while(p5!=NULL);
}
textcolor(14);
gotoxy(15,20);cprintf( "Any Key Back! ");
getch();
}
/*--------------print job information----------------*/
void print2(struct job * head2)
{
struct job * p7;int k=0;
color();textcolor(14);
p7=head2; textcolor(4);
if(head2-> jnum==0)
{ gotoxy(4,4);cprintf( "NO info. of student! "); }
else
{
gotoxy(2,2);cprintf( "Number of Records:%d ",k);
textcolor(0);
gotoxy(5,4);cprintf( "Job Number Job name Amount of Person in need ");
if(head2!=NULL)textcolor(1);
do{
gotoxy(5,5+k);cprintf( "%1d ",p7-> jnum);
gotoxy(18,5+k);cprintf( "%s ",p7-> jname);
gotoxy(43,5+k);cprintf( "%i ",p7-> need);
k++;
p7=p7-> next2;
}while(p7!=NULL);
}
textcolor(14);
gotoxy(15,20);cprintf( "Any Key Back! ");
getch();
}
/*----------delelte applicant-----------*/
struct applicant *del1(struct applicant * head1)
{
struct applicant * p1, * p2;long anum;char c;
color();textcolor(14);
gotoxy(7,3);cprintf( "Eneter Delete Applicant Number: ");
scanf( "%1d ",&anum);
textcolor(128+4);
if(head1==NULL) {gotoxy(12,7);printf( "List Null!) ");goto end; }
p1=head1;
while(anum!=p1-> anum&&p1-> next1!=NULL)
{ p2=p1;p1=p1-> next1;}
if(anum==p1-> anum)
{
if(p1==head1)head1=p1-> next1;
else p2-> next1=p1-> next1;
gotoxy(11,7);
cprintf( "%1d Has Been Deleted! ",anum);
n=n-1;
textcolor(14);
gotoxy(5,12);cprintf( "Save(Y.orN)? ");
c=getch();
if(c== 'Y '|| c== 'y ')save1(head1);
}
else
{
textcolor(128+4);gotoxy(11,7);
cprintf( "%1d Not Been Found! ",anum);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
}
/*---------------delete job-----------*/
struct job *del2(struct job * head2)
{
struct job * p3, * p4;long jnum;char d;
color();textcolor(14);
gotoxy(7,3);cprintf( "Eneter Delete job Number: ");
scanf( "%1d ",&jnum);
textcolor(128+4);
if(head2==NULL) {gotoxy(12,7);printf( "List Null!) ");goto end; }
p3=head2;
while(jnum!=p3-> jnum&&p3-> next2!=NULL)
{ p4=p3;p3=p3-> next2;}
if(jnum==p3-> jnum)
{
if(p3==head2)head2=p3-> next2;
else p4-> next2=p3-> next2;
gotoxy(11,7);
cprintf( "%1d Has Been Deleted! ",jnum);
k=k-1;
textcolor(14);
gotoxy(5,12);cprintf( "Save(Y.orN)? ");
d=getch();
if(d== 'Y '|| d== 'y ')save2(head2);
}
else
{
textcolor(128+4);gotoxy(11,7);
cprintf( "%1d Not Been Found! ",jnum);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
}
/*---------------------arrange applicant--------*/
struct applicant *arrange1(struct applicant *head1)
{
int i,j;struct applicant * p5;
p5=head1;
for(i=0;i <n;i++) {applcnt[i]= * p5;p5=p5-> next1;}
for(j=1;j <n-1;j++)
{
for(i=1;i <=n-j;i++)
if(applcnt[i-1].anum> applcnt[i].anum)
{info1=applcnt[i-1];applcnt[i-1]=applcnt[i];applcnt[i]=info1; }
}
p5=&applcnt[0];
for(i=1;i <n;i++)
{ p5-> next1=&applcnt[i];p5=p5-> next1;}
p5-> next1=NULL;head1=&applcnt[0];
return(head1);
}
/*-----------------arrange job-------------------*/
struct job *arrange2(struct job *head2)
{
int r,f;struct job * p7;
p7=head2;
for(r=0;r <k;r++) {jb[r]= * p7;p7=p7-> next2;}
for(f=1;f <k-1;f++)
{
for(r=1;r <=k-f;r++)
if(jb[r-1].jnum> jb[r].jnum)
{info2=jb[r-1];jb[r-1]=jb[r];jb[r]=info2; }
}
p7=&jb[0];
for(r=1;r <k;r++)
{ p7-> next2=&jb[r];p7=p7-> next2;}
p7-> next2=NULL;head2=&jb[0];
return(head2);
}
/*--------------------insert applicant-----------------*/
struct applicant *insert1(struct applicant *head1)
{
struct applicant * p0, * p1, * p2, * applcnt;char c;
color();
applcnt=(struct applicant * )malloc(LEN);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Record: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Num: "); scanf( "%1d ",&applcnt-> anum);
gotoxy(5,7);cprintf( "Enter Name: "); scanf( "%s ",applcnt-> aname);
gotoxy(5,9);cprintf( "Enter Your ID Number: "); scanf( "%s ",applcnt-> id);
gotoxy(5,11);cprintf( "Enter Your Certification: "); scanf( "%s ",applcnt-> cert);
gotoxy(5,13);cprintf( "Enter Your Ideal Job: "); scanf( "%s ",applcnt-> rqurjob);
p1=head1; p0=applcnt;
if(head1=NULL)
{ head1=p0;p0-> next1=NULL;}
else
while((p0-> anum> p1-> anum)&&(p1-> next1!=NULL))
{ p2=p1; p1=p1-> next1;}
if(p0-> anum <=p1-> anum)
{
if(head1==p1)head1=p0;
else p2-> next1=p0; p0-> next1=p1;
}
else {p1-> next1=p0;p0-> next1=NULL;}
n=n+1;
textcolor(14);
gotoxy(5,16);cprintf( "Save(Y.or,N)? ");
c=getch();
if(c== 'Y '||c== 'y ')save1(head1);
head1=load1();
return(head1);
}
/*------------------insert job----------------------*/
struct job *insert2(struct job * head2)
{
struct job * q0, * p3, * p4, * jb;char d;
color();
jb=(struct job *)malloc(LENB);
textcolor(14);
gotoxy(7,3);cprintf( "Please Enter Job Num: ");
textcolor(1);
gotoxy(5,5);cprintf( "Enter Job Number: "); scanf( "%1d ",&jb-> jnum);
gotoxy(5,7);cprintf( "Enter Job Name: "); scanf( "%s ",jb-> jname);
gotoxy(5,9);cprintf( "Enter The Amount Of The Job Needs: "); scanf( "%i ",jb-> need);
p3=head2; q0=jb;
if(head2==NULL)
{ head2=q0;q0-> next2=NULL;}
else
while((q0-> jnum> p3-> jnum)&&(p3-> next2!=NULL))
{ p4=p3; p3=p3-> next2;}
if(q0-> jnum <=p3-> jnum)
{
if(head2==p3)head2=q0;
else p4-> next2=q0; q0-> next2=p3;
}
else { p3-> next2=q0;q0-> next2=NULL;}
k=k+1;
textcolor(14);
gotoxy(5,12);cprintf( "Save(Y.or,N)? ");
d=getch();
if(d== 'Y '||d== 'y ')save2(head2);
head2=load2();
return(head2);
}
/*----------------------load applicant------------------------*/
struct applicant *load1(void)
{
struct applicant *p1, * p2, * head1;
FILE * fp;
color();textcolor(14);
gotoxy(3,5);cprintf( "Please Enter Loaded Applicant File Name: ");
scanf( "%s ",filename1);
fp=fopen( "filename1.dat ", "r ");
fscanf(fp, "%s ",filename1);
fclose(fp);
if((fp=fopen(filename1, "rb "))==NULL)
{
textcolor(128+4);gotoxy(3,4);
cprintf( "Info1. been not found from %s ! ",filename1);
goto end;
}
p2=p1=(struct applicant * )malloc(LEN);
n=0;
while(! feof(fp))
{
n=n+1;if(n==1)head1=p1;
fread(p1,LEN,1,fp);
p2=p1;
p1=(struct applicant * )malloc(LEN);
p2-> next1=p1;
}
fclose(fp);
n=n-1;
p2-> next1=NULL;
for(p1=head1;p1-> next1-> next1!=NULL;p1=p1-> next1);
p1-> next1=NULL;
clrscr(); textcolor(128+4);
gotoxy(3,5);cprintf( "Info1 Has Been Loaded from %s! ",filename1);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");
getch();
return(head1);
}
/*--------------load job-------------------*/
struct job *load2(void)
{
struct job * p3, * p4, * head2;
FILE *fp;
color();textcolor(14);
gotoxy(3,5);cprintf( "Please Enter Loaded Job File Name: ");
scanf( "%s ",filename2);
fp=fopen( "filename2.dat ", "r ");
fscanf(fp, "%s ",filename2);
fclose(fp);
if((fp=fopen(filename2, "rb "))==NULL)
{
textcolor(128+4);gotoxy(3,4);
cprintf( "Info2. been not found from %s ! ",filename2);
goto end;
}
p4=p3=(struct job * )malloc(LENB);
k=0;
while(! feof(fp))
{
k=k+1;if(k==1)head2=p3;
fread(p3,LENB,1,fp);
p4=p3;
p3=(struct job * )malloc(LENB);
p4-> next2=p3;
}
fclose(fp);
k=k-1;
p4-> next2=NULL;
for(p3=head2;p3-> next2-> next2!=NULL;p3=p3-> next2);
p3-> next2=NULL;
clrscr(); textcolor(128+4);
gotoxy(3,5);cprintf( "Info2 Has Been Loaded From %s! ",filename2);
end:textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");
getch();
return(head2);
}
/*---------------------save applicant------------------------*/
save1(struct applicant * head1)
{
FILE * fp; struct applicant * p5;
color();textcolor(14);
p5=head1;
gotoxy(3,5);cprintf( "Please Enter Saved Applicant File Name: ");
scanf( "%s ",filename1);
fp=fopen( "filename1.dat ", "w ");
fprintf(fp, "%s ",filename1);
fclose(fp);
fp=fopen(filename1, "wb ");
while(p5=NULL){ fwrite(p5,LEN,1,fp);p5=p5-> next1;}
fclose(fp);
textcolor(128+4);clrscr();
gotoxy(2,3);
cprintf( "%d Applicant Record Has Been Saved To %s ! ",n,filename1);
textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
/*------------------save job------------------------*/
save2(struct job * head2)
{
FILE * fp; struct job * p7;
color();textcolor(14);
p7=head2;
gotoxy(3,5);cprintf( "Pleas Enter Saved Job File Name: ");
scanf( "%s ",filename2);
fp=fopen( "filename2.dat ", "w ");
fprintf(fp, "%s ",filename2);
fclose(fp);
fp=fopen(filename2, "wb ");
while(p7=NULL){ fwrite(p7,LENB,1,fp);p7=p7-> next2;}
fclose(fp);
textcolor(128+4);clrscr();
gotoxy(2,3);
cprintf( "%d Job Record Has Been Saved To %s ! ",k,filename2);
textcolor(14);
gotoxy(15,14);cprintf( "Any Key Back! ");getch();
}
/*------------------------main-------------------------*/
main()
{
char m,c;
struct applicant * head1;
struct job * head2;
textmode(7);textmode(3); textbackground(11);
color();textcolor(14);
gotoxy(12,5);cprintf( "Welcome To Use ");
textcolor(14);
gotoxy(7,7);cprintf( "Intermediary Information Management System ");
gotoxy(12,9);cprintf( "Written By Aaron Harvey ");
textcolor(128+11); gotoxy(2,14);
cprintf( " Any Key Continue! ESC to exit ");
c=getch();
if(ESC==c)exit(0);
menu:
m=menu();
switch(m)
{
case '1 ':head1=create1(); break;
case '2 ':print1(head1); break;
case '3 ':head1=del1(head1); break;
case '4 ':head1=insert1(head1); break;
case '5 ':head1=load1(); break;
case '6 ':head2=create2(); break;
case '7 ':print2(head2); break;
case '8 ':head2=del2(head2); break;
case '9 ':head2=insert2(head2); break;
case '10 ':head2=load2(); break;
case '0 ':textmode(11); exit(0);
}
goto menu;
}
㈨ 求C語言學生信息管理系統源代碼
給你點建議吧,錄入功能你就用scanf進行錄入,瀏覽功能你可以遍歷你的所有數據,依次輸出即可,查詢最簡單的就是用順序查找,排序可以採用冒泡法
㈩ 計算機軟體著作權登記-源代碼範本如何提交
計算機軟體著作權登記-源代碼範本的提交需要有關的當事人把源程序的前、後各連續的30頁,其中的機密部分用黑色寬斜線覆蓋,但覆蓋部分不得超過交存源程序的50%;目標程序的前、後各連續的30頁,加上源程序的任何部分的連續的20頁進行整合。
計算機軟體著作權登記計算機軟體著作權登記按照中華人民共和國國家版權局2002年頒布的《計算機軟體著作權登記辦法》第十二條申請軟體著作權登記的,可以選擇以下方式之一對鑒別材料作例外交存:(一)源程序的前、後各連續的30頁,其中的機密部分用黑色寬斜線覆蓋,但覆蓋部分不得超過交存源程序的50%;(二)源程序連續的前10頁,加上源程序的任何部分的連續的50頁;(三)目標程序的前、後各連續的30頁,加上源程序的任何部分的連續的20頁。
計算機軟體著作權登記,指軟體著作權人協商不一致的,任何著作權人均可在不損害其他著作權人利益的前提下申請登記,但應當註明其他著作權人。
第一條為貫徹《計算機軟體保護條例》(以下簡稱《條例》)制定本辦法。
第二條為促進我國軟體產業發展,增強我國信息產業的創新能力和競爭能力,國家著作權行政管理部門鼓勵軟體登記,並對登記的軟體予以重點保護。
第三條本辦法適用於軟體著作權登記、軟體著作權專有許可合同和轉讓合同登記。
第四條軟體著作權登記申請人應當是該軟體的著作權人以及通過繼承、受讓或者承受軟體著作權的自然人、法人或者其他組織。
軟體著作權合同登記的申請人,應當是軟體著作權專有許可合同或者轉讓合同的當事人。
第五條申請人或者申請人之一為外國人、無國籍人的,適用本辦法。
第六條國家版權局主管全國軟體著作權登記管理工作。
國家版權局認定中國版權保護中心為軟體登記機構。
經國家版權局批准,中國版權保護中心可以在地方設立軟體登記辦事機構。