學生管理網站課程設計
⑴ jsp課程設計—學生管理系統
學生管抄理系統jsp課程設計
學生管理系統jsp+servlet+mysql非常簡單,前端可以用bootstrap來做,這個就是做了登陸注冊功能外再對學生實體進行增刪改查
javaweb開發環境是什麼?
javaweb的開發環境對系統沒有太大要求,linux與windows都可以,推薦用jdk1.8,資料庫可以用mysql,開發ide推薦使用eclipse,也可以使用idea
javaweb開發中jsp是做什麼用的
jsp主要是用來做模板的作用,也就是頁面展示,servlet會將數據扔給jsp,jsp通過使用jstl來渲染路由給的數據,比較復合mvc設計模式
javaweb項目中資料庫設計規范
規范化的優點是減少了數據冗餘,節約了存儲空間,相應邏輯和物理的I/O次數減少,同時加快了增、刪、改的速度。但是一個完全規范化的設計並不總能生成最優的性能,因為對資料庫查詢通常需要更多的連接操作,從而影響到查詢的速度,而且範式越高性能就會越差
⑵ 學生成績管理系統課程設計
你好,我曾用c++學生成績管理系統的程序,希望能對你有所幫助。
#include <string.h>
#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
/*------------------------------------定義類部分------------------------------------------------*/
class Node
{
char name[10];
int score;
class Node *next;
public:
Node* CreateNode(int n);
void PrinfListNode(Node *h);
void InsertList(Node *h,int i,char name[],int e,int *n);
void DeleteList(Node *h,int i,int *n);
Node* operator +=(Node *p);
Node *Unique(Node *p,int *n);
};
void DisplayNote(void);
/*--------------------建立單鏈表的成員函數,單鏈表節點的個數不確定--------------------------------*/
Node *Node::CreateNode(int n)
{
Node *head;
Node *pre,*p;
int i;
head=(Node*)malloc(sizeof(Node)); //用malloc動態申請內存,個數作為函數的輸入參數
head->next=NULL;
pre=head;
for (i=1;i<=n;i++)
{
printf("請輸入學生姓名:",i);
p=(Node*)malloc(sizeof(Node));
scanf("%s",p->name);
printf("請輸入此學生的分數:",i);
scanf("%d",&p->score);
pre->next=p;
pre=p;
}
p->next=NULL;
return head;
}
/*---------------------------------輸出鏈表函數實現部分------------------------------------------*/
void Node::PrinfListNode(Node *h)
{
Node *p;
p=h->next;
while(p)
{
printf("name:%s\tscore:%d",p->name,p->score);
p=p->next;
printf("\n");
}
}
/*----------------------------實現單鏈表的插入操作的成員函數--------------------------------------*/
void Node::InsertList(Node *h,int i,char name[],int e,int *n)
{
Node *p,*q;
int j;
if (i<1||i>(*n)+1)
{
printf("出錯啦!請重試!.\n");
}
else
{
j=0;p=h;
while(j<i-1)
{
p=p->next;
j++;
}
q=(Node *)malloc(sizeof(Node));
strcpy(q->name,name);
q->score=e;
q->next=p->next;
p->next=q;
(*n)++;
}
}
/*-----------------------------實現單鏈表的刪除操作的成員函數-------------------------------------*/
void Node::DeleteList(Node *h,int i,int *n)
{
Node *p,*q;
int j;
char name[10];
int score;
if (i<1||i>(*n))
{
printf("出錯啦!請重試!.\n");
}
else
{
j=0;p=h;
while(j<i-1)
{
p=p->next;
j++;
}
q=p->next;
p->next=q->next;
strcpy(name,q->name);
score=q->score;
free(q);
(*n)--;
}
}
/*--------------------------重載運算符「+=」實現兩個鏈表對象合並功能------------------------------*/
Node *Node::operator +=(Node *p)
{
Node *q=this;
while(q->next!=NULL) //把第一個鏈表最後的next指向第二個的頭
{
q=q->next;
}
q->next=p->next;
return this;
}
/*----------------編寫Unique()成員函數,實現剔除鏈表中重復元素,使所有節點值唯-----------------*/
Node *Node::Unique(Node *p,int *n)
{ Node *q=this,*k,*m;
int i;
if((*n)<=1) //用循環,拿一個和每一個去比較,一樣的刪除使用已經寫好的刪除函數
cout<<"ERROR!"<<endl;
else
{
for(i=1;i<(*n);q=q->next)
{
k=q;
p=q->next;
while(p!=NULL)
{
if(strcmp(q->name,p->name)==0)
{
m=p;
p=p->next;
k->next=m->next;
free(m);
(*n)--;
}
else{
k=p;
p=p->next;
}
}
}
}
return this;
}
/*--------------------------------編寫主函數測試上述功能---------------------------------------*/
int main()
{
Node *h,*k;
int i=1,n,score;
char name[10];
int *m=0;
while(i)
{
DisplayNote();
scanf("%d",&i);
switch(i)
{
case 1:
printf("請輸入表中成員的個數:\n");
scanf("%d",&n);
h=h->CreateNode(n);
printf("表中成員為:\n");
h->PrinfListNode(h);
break;
case 2:
printf("請寫出成員的位置:");
scanf("%d",&i);
printf("請輸入學生姓名:");
scanf("%s",&name);
printf("請輸入學生分數:");
scanf("%d",&score);
h->InsertList(h,i,name,score,&n);
printf("表中成員為:\n");
h->PrinfListNode(h);
break;
case 3:
printf("請寫出成員的位置:");
scanf("%d",&i);
h->DeleteList(h,i,&n);
cout<<"表中成員為:\n";
h->PrinfListNode(h);
break;
case 4:
printf("表中成員為:\n");
h->PrinfListNode(h);
break;
case 5:
printf("請輸入另一個表中成員的個數:\n");
scanf("%d",&n);
k=k->CreateNode(n);
h=h->operator +=(k);
printf("兩個鏈表相加之後的鏈表是:\n");
h->PrinfListNode(h);
break;
case 6:
h=h->Unique(h,&n);
printf("剔除重復元素後的新鏈表是:\n");
h->PrinfListNode(h);
break;
case 0:
return 0;
break;
default:
printf("出錯啦!請重試!");
}
}
return 0;
}
void DisplayNote(void)
{
printf("1--建立新的鏈表\n");
printf("2--添加元素\n");
printf("3--刪除元素\n");
printf("4--輸出當前鏈表中的內容\n");
printf("5--兩個鏈表對象合並\n");
printf("6--剔除鏈表中重復元素\n");
printf("0--退出\n");
}
⑶ 求一份學生管理系統課程設計報告,數據結構課程設計
|」為什麼要中間拿那麼多空格隔開呢?逗號或「|」都比那好弄。
如果這題是老師出的,老師一定腦袋有問題。
//==============
效果圖查詢自己寫
需要的控制項
private System.Windows.Forms.Button button1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
後台
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text;
using System.IO;
namespace WindowsFormsApplication1
{
public partial class cj : Form
{
public StreamWriter SW;
public cj()
{
InitializeComponent();
string Header = "姓名" + " " + "學號" + " " + "語文" + " " + "數學" + " " + "英語" + "
";
richTextBox1.AppendText(Header);
richTextBox2.AppendText(Header);
CheckDirectory();
}
private void button1_Click(object sender, EventArgs e)
{
string strFile;
strFile = System.Windows.Forms.Application.StartupPath + "\3.txt";
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.Filter = "文本文件(*.txt)|*.txt";
openFileDialog1.DefaultExt = "txt";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
string FileName = openFileDialog1.FileName;
if (Path.GetExtension(FileName) != ".txt")
{
MessageBox.Show("格式不對");
}
else
{
FileStream stream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
StreamReader sReader = new StreamReader(openFileDialog1.FileName, Encoding.Default);
if (sReader.ReadLine().Split('
').Length > 0)
{
richTextBox1.AppendText(sReader.ReadToEnd());
}
richTextBox1.AppendText("
");
// StreamWriter ssw = new System.IO.StreamWriter(FileName, true, System.Text.Encoding.Default);
}
}
}
private void WriteLog(string msg)
{
string strFile;
strFile = System.Windows.Forms.Application.StartupPath + "\data\3.log";
// StreamWriter SW;
try
{
SW = new System.IO.StreamWriter(strFile, true);
SW.WriteLine(msg);
}
catch (Exception ex)
{
WriteLog(ex.Message);
}
finally
{
SW.Flush();
SW.Close();
}
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox1.Text = "姓名" + " " + "學號" + " " + "語文" + " " + "數學" + " " + "英語" + "
";
}
private void CheckDirectory()
{
if (Directory.Exists(System.Windows.Forms.Application.StartupPath + "\data") == false)
{
Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\data");
}
if (Directory.Exists(System.Windows.Forms.Application.StartupPath + "\data") == false)
{
Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\data");
}
}
private void button3_Click(object sender, EventArgs e)
{
string rowdata = "";
int m = richTextBox1.Lines.Length;
string[] lines = new string[m];
for (int i = 1; i < m-1; i++) //每一行
{
lines[i] = richTextBox1.Lines[i]+"
";
string[] cj = lines[i].Split(' ');
if (cj != null)
{
rowdata = " ";
for (int j = 0; j < cj.Length; j++) //每一列
{
if (cj[j].ToString() != "")
{
rowdata = rowdata + cj[j].ToString()+",";
}
}
rowdata.TrimEnd(',');
string[] ncj = rowdata.Split(',');
string str2 = ncj[2].ToString();
string str3 = ncj[3].ToString();
string str4 = ncj[4].ToString().TrimEnd('
');
// if ((int.Parse(str2) + int.Parse(str3) + int.Parse(str4) < 180))
if ((int.Parse(str2)<60 || int.Parse(str3)<60 || int.Parse(str4) < 60))
{
richTextBox2.AppendText(lines[i]);
}
}
}
if (File.Exists(System.Windows.Forms.Application.StartupPath + "\data\3.txt") == true)
{
File.Delete(System.Windows.Forms.Application.StartupPath + "\data\3.txt");
}
File.AppendAllText(System.Windows.Forms.Application.StartupPath + "\data\3.txt", richTextBox1.Text);
if (File.Exists(System.Windows.Forms.Application.StartupPath + "\data\4.txt") == true)
{
File.Delete(System.Windows.Forms.Application.StartupPath + "\data\4.txt");
}
File.AppendAllText(System.Windows.Forms.Application.StartupPath + "\data\4.txt", richTextBox2.Text);
MessageBox.Show("數據合成OK,在data文件夾");
}
}
}
⑷ 誰幫我做一個學生管理系統的課程設計
c++學生管理系統程序
#include<iostream.h>
#include<string.h>
#include<fstream.h>
class stu
{
char name[20];
double math,chinese,english,average,sum;
public:
stu()
{
}
stu(char n[20],double ma,double chin,double eng)
{
strcpy(name,n);
math=ma;
chinese=chin;
english=eng;
}
double getsum()
{
sum=chinese+english+math;
return sum;
}
double getaver()
{
average=getsum()/3;
return average;
}
friend void main();
};
void main()
{
cout<<"請選擇您需要的操作!"<<endl;
cout<<"操作:"<<endl;
cout<<"(0)數據錄入"<<endl;
cout<<"(1)增加人員"<<endl;
cout<<"(2)刪除人員"<<endl;
cout<<"(3)修改數據"<<endl;
cout<<"查詢:"<<endl;
cout<<"(4)按總成績查詢"<<endl;
cout<<"(5)按姓名查詢"<<endl;
cout<<"(6)輸出所有學生的數據"<<endl;
cout<<"成績名詞"<<endl;
cout<<"(7)按總分查詢排名"<<endl;
cout<<"(8)按語文查詢排名"<<endl;
cout<<"(9)按數學查詢排名"<<endl;
cout<<"(y)按英語查詢排名"<<endl;
cout<<"選擇相關操作請輸入相對的括弧里的阿拉伯數字!"<<endl;
char p;char w;
stu *s[50];
ofstream *file[50];
int i=0;
int j=0;
bool flag2=0;
do
{
cin>>p;
if((p>='0'&&p<='10'))
flag2=1;
else
cout<<"指令錯誤!請重新輸入:"<<endl;
}while(flag2==0);
do{
switch(p)
{
case '0':
{
char c;
char name[20];double math,chinese,english;
do{
cout<<"請輸入姓名"<<endl;
cin>>name;
cout<<"請輸入數學成績:"<<endl;
cin>>math;
cout<<"請輸入語文成績:"<<endl;
cin>>chinese;
cout<<"請輸入外語成績:"<<endl;
cin>>english;
file[j]=new ofstream("d:\\document",ios::ate);
*file[j]<<"姓名"<<name<<"數學成績"<<math<<"語文成績"<<chinese<<"外語成績"<<english<<endl;
j++;
s[i]=new stu(name, math, chinese, english);
i++;
cout<<"數據錄入成功,想繼續錄入嗎(y/n)"<<endl;
cin>>c;
flag2=0;
do
{
if(c!='y'&&c!='n')
{
cout<<"指令錯誤!請重新輸入!"<<endl;
cin>>c;
}
else
flag2=1;
}while(flag2==0);
}while(c=='y');
break;
}
case '4':
{
double t;char c;
do
{
int flag1=0;
cout<<"請輸入你要查詢學生的總成績"<<endl;
cin>>t;
for(int q=0;q<i;q++)
{
if(s[q]->getsum()==t)
{
flag1=1;
cout<<"您要查詢的學生是:"<<(*s[q]).name<<endl;
}
}
if(flag1==0)
cout<<"對不起!您要查詢的學生不存在!"<<endl;
cout<<"您想繼續查詢嗎?(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令錯誤!請重新輸入!"<<endl;
cin>>c;
}
}
while(c=='y');
break;
}
case '5':
{
char n[20];int j=0;char c;
do{
int flag=0;
cout<<"請輸入你要查詢的學生姓名"<<endl;
cin>>n;
for(int j=0;j<i;j++)
{
if(strcmp(n,(*s[j]).name)==0)
{
flag=1;
cout<<"您要查詢的學生是:"<<(*s[j]).name<<endl;
cout<<(*s[j]).name<<"的總成績成績是"<<(*s[j]).getsum()<<endl<<"平均成績是:"<<(*s[j]).getaver()<<endl;
}
}
if(flag==0)
cout<<"對不起!您要查詢的學生不存在!"<<endl;
cout<<"您想繼續查詢嗎?(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令錯誤!請重新輸入!"<<endl;
cin>>c;
}
}
while(c=='y');
break;
}
case '1':
{
char name[20];double math,chinese,english;
char c;
do
{
cout<<"請輸入您要增加的學生的姓名:"<<endl;
cin>>name;
cout<<"請輸入數學成績:"<<endl;
cin>>math;
cout<<"請輸入語文成績:"<<endl;
cin>>chinese;
cout<<"請輸入外語成績:"<<endl;
cin>>english;
file[j]=new ofstream("d:\\document",ios::ate);
*file[j]<<"姓名"<<name<<"數學成績"<<math<<"語文成績"<<chinese<<"外語成績"<<english<<endl;
j++;
s[i]=new stu(name, math, chinese, english);
i++;
cout<<"數據錄入成功,想繼續錄入嗎(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令錯誤!請重新輸入!"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case '2':
{
char name[20];bool flag3=0;char c;
do{
cout<<"請輸入您要刪除的學生姓名:"<<endl;
cin>>name;
for(int h=0;h<i;h++)
{
if(strcmp(name,s[h]->name)==0)
{
flag3=1;
i--;
do{
s[h]=s[h+1];
h++;
}while(h<=i);
}
}
if(flag3==0)
cout<<"您要求刪除的對象本來就不存在!請檢查輸入的正確性!";
cout<<"要繼續刪除嗎?(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令錯誤!請重新輸入!"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case '3':
{
char name[20];double mat,chin,eng;flag2=0;
char c;
do
{
cout<<"請輸入您要修改的學生的姓名:"<<endl;
cin>>name;
for(int h=0;h<i;h++)
{
if(strcmp(name,s[h]->name)==0)
{
flag2=1;
cout<<"請輸入新的數學成績:"<<endl;
cin>>mat;
cout<<"請輸入新的語文成績:"<<endl;
cin>>chin;
cout<<"請輸入新的外語成績:"<<endl;
cin>>eng;
s[h]->chinese=chin;
s[h]->math=mat;
s[h]->english=eng;
cout<<"數據修改成功!";
}
}
if(flag2==0)
{
cout<<"您要修改的學生本來就不存在!請檢查重新輸入!"<<endl;
}
cout<<"想繼續修改嗎(y/n)"<<endl;
cin>>c;
if(c!='y'&&c!='n')
{
cout<<"指令錯誤!請重新輸入!"<<endl;
cin>>c;
}
}while(c=='y');
break;
}
case '6':
{
cout<<"本系統所有學生數據如下:"<<endl;
if(i==0)
cout<<"管理系統中沒有錄入數據或者數據已經被刪除!"<<endl;
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"語文:"<<" "<<s[k]->chinese<<"數學:"<<" "<<s[k]->math
<<"外語:"<<" "<<s[k]->english<<"總分:"<<" "<<(*s[k]).getsum()
<<"平均分:"<<" "<<(*s[k]).getaver()<<endl;
}
break;
}
case '7':
{
int t;stu b;
cout<<"本系統所以學生排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->getsum())<(s[y]->getsum()))
t=y;
if(t!=x)
{
b=*s[x];
*s[x]=*s[t];
*s[t]=b;
}
}
}
if(i==0)
cout<<"管理系統中沒有錄入數據或者數據已經被刪除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"語文:"<<" "<<s[k]->chinese<<"數學:"<<" "<<s[k]->math
<<"外語:"<<" "<<s[k]->english<<"總分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
break;
}
case '8':
{
int t;stu b;
cout<<"本系統所以學生語文排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->chinese)<(s[y]->chinese))
t=y;
if(t!=x)
{
b=*s[t];
*s[t]=*s[x];
*s[x]=b;
}
}
}
if(i==0)
cout<<"管理系統中沒有錄入數據或者數據已經被刪除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"語文:"<<" "<<s[k]->chinese<<"數學:"<<" "<<s[k]->math
<<"外語:"<<" "<<s[k]->english<<"總分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
break;
}
case '9':
{
int t;stu b;
cout<<"本系統所以學生數學排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->math)<(s[y]->math))
t=y;
if(t!=x)
{
b=*s[t];
*s[t]=*s[x];
*s[x]=b;
}
}
}
if(i==0)
cout<<"管理系統中沒有錄入數據或者數據已經被刪除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"語文:"<<" "<<s[k]->chinese<<"數學:"<<" "<<s[k]->math
<<"外語:"<<" "<<s[k]->english<<"總分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
break;
}
case 'y':
{
int t;stu b;
cout<<"本系統所以學生英語排名如下:"<<endl;
for(int x=0;x<i-1;x++)
{
t=x;
for(int y=x+1;y<i;y++)
{
if((s[t]->english)<(s[y]->english))
t=y;
if(t!=x)
{
b=*s[t];
*s[t]=*s[x];
*s[x]=b;
}
}
}
if(i==0)
cout<<"管理系統中沒有錄入數據或者數據已經被刪除!";
for(int k=0;k<i;k++)
{
cout<<k+1<<" "<<"姓名:"<<" "<<s[k]->name<<
"語文:"<<" "<<s[k]->chinese<<"數學:"<<" "<<s[k]->math
<<"外語:"<<" "<<s[k]->english<<"總分:"<<" "<<s[k]->getsum()
<<"平均分:"<<" "<<s[k]->getaver()<<endl;
}
}
break;
}
cout<<"您想繼續進行其他操作嗎?(y/n)"<<endl;
bool flag4=0;
do
{
cin>>w;
if(w!='y'&&w!='n')
cout<<"指令錯誤!請重新輸入!"<<endl;
else
flag4=1;
}while(flag4==0);
if(w=='y')
cout<<"請輸入操作代碼(0 錄入/4 按總分查詢/5 按姓名查詢/1 增加人員/2 刪除人員/3 修改數據/6 顯示所有成員數據/7 按總分排名/8 按語文排名/9按數學排名/y按英語排名)"<<endl;
cin>>p;
}while(w=='y');
for(int x=0;x<i;x++)
{
delete s[x];
cout<<"delete all members!"<<endl;
}
}
⑸ 學生信息管理系統課程設計
你確定實體先。然後在設計。
屬性這不挺明顯的嗎?
學生 課程 分數
⑹ 完整的c語言學生管理系統課程設計
10財富值就想要個完整的,特么是窮瘋了吧,思路都不告訴你
⑺ 學生成績管理系統課程設計.
#include <iostream>#include <stdio.h>#include <string.h>#include <conio.h>#include <iostream>#include <ctime>using namespace std;#define max 100
//////////////////////////////////////////////////////////////////////////strcut stustruct stu //學生資料結構體{ char name[10]; char num[20]; //學號 char adress[8]; float x,y,z,score; int number;};
//////////////////////////////////////////////////////////////////////////////student.cppint count=0;int temp=0;int Exchang=0; //定義數據修改標志,若修改則為1,否則為0class student //學生類{private: stu data[max]; char start_del;public: void input(char *ch1,char *num,char *ch2,float x,float y,float z); //輸入 void find(char *num); //查找 void del(char *num); //刪除 int check_num(char *num) //確定沒有重復學號 { int m=0; while(m<=count) if(!strcmp(num,data[m++].num)) //判斷是否相同 break; if(m>count) return 0; else return 1; } void taxis(); //總分排序 void show(); void save(); //保存學生資料 void read(); //從文件"student"讀取學生資料};
void student::input(char *ch1,char *num,char *ch2,float x,float y,float z){ strcpy(data[count].name,ch1); strcpy(data[count].num,num); strcpy(data[count].adress,ch2); data[count].x=x; data[count].y=y; data[count].z=z; count++; Exchang=1; //設置已修改數據標志}void student::find(char * num){ int m=0; while(m<=count) if(!strcmp(num,data[m++].num)) break; if(m>count) { cout << "很抱歉,沒有該學號的學生" << endl; start_del='n'; getch(); } else { temp=count; count=m; start_del='y'; cout << "該學生的資料為" <<endl << "序號\t姓名\t學號\t\t地址\t\t\t高數\t英語\t計算機" << endl; show(); count=temp; getch(); }}void student::del(char *num){ char chose; find(num); if(start_del=='y') {
cout << "確實要刪除該學生資料? Y/N" << endl; cin >> chose; if(chose=='y') { int m=0; while(m<count) if(strcmp(num,data[m++].num)==0) //錯在這里 break; temp=count; count=m; if(temp==count) { count=temp-1;printf("2"); cout << "該學生資料已刪除" << endl; Exchang=1; //設置已修改數據標志 } else { while(count<temp) { strcpy(data[count-1].name,data[count].name); strcpy(data[count-1].num,data[count].num); strcpy(data[count-1].adress,data[count].adress); data[count-1].x=data[count].x; data[count-1].y=data[count].y; data[count-1].z=data[count].z; count++;
}printf("1"); count=temp-1; cout << "該學生資料已刪除" << endl; Exchang=1; //設置已修改數據標志 } } else cout << "學生資料未刪除" << endl; getch();
}}void student::taxis(){ int x,y,array[max]; int change; for(x=0;x<count;x++) array[x]=data[x].score=data[x].x+data[x].y+data[x].z; for(x=0;x<count-1;x++) for(y=0;y<count-1-x;y++) if(array[y]<array[y+1]) { change=array[y]; array[y]=array[y+1]; array[y+1]=change; } cout << "總分\t姓名\t學號\t\t地址\t\t高數\t英語\t計算機" << endl; for(x=0;x<count;x++) for(y=0;y<count;y++) if(array[x]==data[y].score) { cout << data[y].score << "\t" << data[y].name << "\t" << data[y].num << "\t" << data[y].adress << "\t" << data[y].x << "\t" << data[y].y << "\t" << data[y].z << endl; } getch(); Exchang=1; //設置已修改數據標志}
void student::show(){ cout << count << "\t" << data[count-1].name << "\t" << data[count-1].num << "\t" << data[count-1].adress << "\t\t" << data[count-1].x << "\t" << data[count-1].y << "\t" << data[count-1].z << endl;}
//////////////////////////////////////////////////////////////////////main.cppvoid main(){ student st; char *ch1,*ch2,chose; char flag[2],num[20],find[20],del[20]; char ch;
float x,y,z; time_t t; time(&t);
while(1) { system("cls"); cout << "------------------------學生管理系統------------------------" <<endl
<< " 1.輸入/添加學生資料 "<<endl << " 2.輸出學生資料" <<endl << " 3.查找 " <<endl << " 4.刪除" <<endl << " 5.總分排序" <<endl << " 6.退出" << endl << endl << " 請選擇你要的服務(1-6)" << endl; cin >> chose; if(chose=='6') { break; } switch(chose) { case '1': // 輸入學生信息 { do { cout << "請輸入學生姓名:" << endl; ch1=new char[]; ch2=new char[]; cin >> ch1 ; cout << "請輸入學號:" << endl; cin >> num ; while(st.check_num(num)) { cout << "學號重復,請重新輸入" << endl; cin >> num; } cout << "請輸入地址:"<<endl; cin >> ch2 ; cout << "請輸入高數成績:"<<endl; cin >> x; cout << "請輸入英語成績:" <<endl; cin >> y; cout << "請輸入計算機成績:" <<endl; cin >> z; st.input(ch1,num,ch2,x,y,z); printf("\n是否繼續輸入學生信息?(\"y\"繼續)"); scanf("%s", flag); }while(strcmp(flag, "y") == 0); }break; case '2':// 輸出學生資料 { temp=count; count=1; cout << "序號\t姓名\t學號\t\t地址\t\t\t高數\t英語\t計算機" << endl; while(count<=temp) { st.show(); count++; } count--; getch(); }break; case '3': { cout << "請輸入你要查找學生的學號" << endl; cin >> find; st.find(find); }break; case '4': { cout << "請輸入你要刪除的學生學號" << endl; cin >> del; st.del(del); }break; case '5': { st.taxis(); }break;
default: { cout << "輸入錯誤!!!,請重新輸入" << endl; getch(); } } } cout << "感謝你的使用!\n" <<endl; getch();
}
⑻ 怎麼做一個學生信息管理系統的課程設計
去學術期刊搜