第一篇:圖書管理系統(tǒng)源代碼
環(huán)植學(xué)院深入開展創(chuàng)先爭優(yōu)活動實施方案
為貫徹落實中共中央、海南省委、省委教育工委及學(xué)校黨委“關(guān)于在黨的基層組織和黨員中深入開展創(chuàng)先爭優(yōu)活動”的決定,根據(jù)相關(guān)文件精神,結(jié)合我院實際,特制定如下實施方案。
一、總體要求
根據(jù)上級黨組織要求,以鄧小平理論和“三個代表”重要思想為指導(dǎo),以深入學(xué)習(xí)實踐科學(xué)發(fā)展觀、實現(xiàn)海南大學(xué)又好又快發(fā)展為主題,以加快“211工程”建設(shè)、促進新海大轉(zhuǎn)型升級為載體,以樹立優(yōu)良校風(fēng)學(xué)風(fēng)和立足崗位奉獻為重點,堅持服務(wù)學(xué)校教學(xué)科研和建設(shè)發(fā)展大局,振奮精神,改革創(chuàng)新,講求實效,統(tǒng)籌推進黨的建設(shè)及其他經(jīng)常性工作,充分發(fā)揮基層黨組織的戰(zhàn)斗堡壘作用和共產(chǎn)黨員的先鋒模范作用,在推動科學(xué)發(fā)展、構(gòu)建和諧校園、服務(wù)師生員工、加強基層組織以及服務(wù)海南國際旅游島建設(shè)的實踐中建功立業(yè)。
通過開展創(chuàng)先爭優(yōu)活動,整體提高學(xué)院各級黨組織和黨員隊伍建設(shè)水平,樹立一批充分發(fā)揮戰(zhàn)斗堡壘作用、先鋒模范作用的先進黨支部和優(yōu)秀共產(chǎn)黨員,為學(xué)校順利完成“211工程”項目建設(shè)、實現(xiàn)轉(zhuǎn)型升級,進而更好地服務(wù)海南國際旅游島建設(shè)提供堅強的政治保證和組織保證。
二、主要內(nèi)容
創(chuàng)先爭優(yōu)活動的主要內(nèi)容:創(chuàng)建先進基層黨組織、爭當優(yōu)秀共產(chǎn)黨員。
1、先進基層黨組織的基本要求:建設(shè)學(xué)習(xí)型黨組織,努力做到“五個好”: 一是領(lǐng)導(dǎo)班子好。深入學(xué)習(xí)實踐科學(xué)發(fā)展觀,全面貫徹黨的教育方針,認真落實黨建工作責(zé)任制,團結(jié)協(xié)作,求真務(wù)實,勤政廉潔,有較強的凝聚力、戰(zhàn)斗力和創(chuàng)造力。二是黨員隊伍好。重視教職工黨員的發(fā)展和教育,黨員素質(zhì)優(yōu)良、黨員意識較強、精神面貌良好,切實發(fā)揮先鋒模范作用。三是工作機制好。圍繞學(xué)院改革發(fā)展開展形式多樣黨建活動,規(guī)章制度健全完善,管理措施到位,長效機制建立務(wù)實有效。四是工作業(yè)績好。在開展“211工程”項目建設(shè)、深化教育教學(xué)改革、推進學(xué)校各項事業(yè)中強化黨的政治領(lǐng)導(dǎo),圍繞中心、服務(wù)大局,解決問題、促進發(fā)展,改革創(chuàng)新、成效明顯。五是群眾反映好。尊重愛護師生,為師生辦實事;工作措施符合師生意愿,工作作風(fēng)和工作實績師生滿意度高,黨組織得到師生擁護,黨群干群關(guān)系密切。
學(xué)生黨支部主要突出“三個好”:黨員培育好。能積極、有效做好大學(xué)生黨員的發(fā)展、教育和管理工作,引導(dǎo)廣大學(xué)生樹立堅定的共產(chǎn)主義理想和信念;組織活動好。經(jīng)常組織開展健康向上、豐富多樣的支部活動,支部建設(shè)充滿活力;發(fā)揮作用好。能較好地發(fā)揮支部的戰(zhàn)斗堡壘作用,以黨建帶團建,以黨建促進其他學(xué)生組織的健康發(fā)展和優(yōu)良學(xué)風(fēng)、班風(fēng)、校風(fēng)的形成,維護校園安全穩(wěn)定,在學(xué)生中具有較強的感召力。
2、優(yōu)秀共產(chǎn)黨員的基本要求:模范履行黨章規(guī)定的義務(wù),努力爭當“五個模范”。教工黨員要爭當:(1)學(xué)習(xí)鉆研的模范。認真學(xué)習(xí)實踐科學(xué)發(fā)展觀,刻苦鉆研業(yè)務(wù)知識,努力提高自身的黨性修養(yǎng)和能力水平,成為熱愛學(xué)習(xí)、學(xué)會學(xué)習(xí)和終身學(xué)習(xí)的楷模;(2)崗位奉獻的模范。忠誠于黨的教育事業(yè),具有強烈的事業(yè)心、責(zé)任感,愛崗敬業(yè),勇挑重擔(dān),在教學(xué)、科研、管理或服務(wù)崗位上做出顯著業(yè)績;(3)為人師表的模范。養(yǎng)成求真務(wù)實和嚴謹自律的治學(xué)態(tài)度,樹立高尚的道德情操和精神追求,教書育人、管理育人、服務(wù)育人,言傳身教,甘為人梯,以大德樹良師形象;(4)團結(jié)協(xié)作的模范。熱愛集體,服務(wù)師生,團結(jié)友愛,堅決維護集體榮譽。樹立大局意識和團隊精神,以團隊協(xié)作爭創(chuàng)教學(xué)、科研的高層次成果,提升單位的整體管理、服務(wù)水平;(5)遵紀守法的模范。自覺遵守黨的紀律,帶頭遵守國家法律法規(guī)及學(xué)校各項規(guī)章制度,堅持原則,弘揚正氣,敢于同不良風(fēng)氣、違紀違法行為作斗爭。
學(xué)生黨員要爭當努力學(xué)習(xí)的模范、實踐創(chuàng)新的模范、自強自立的模范、尊師愛友的模范、遵紀守法的模范,努力使自己成為志向遠大、品德高尚、知識豐富、能力較強的高素質(zhì)的優(yōu)秀學(xué)生。
三、方法步驟
按照上級組織要求,創(chuàng)先爭優(yōu)活動通過公開承諾、領(lǐng)導(dǎo)點評、群眾評議、評選表彰的方式,圍繞迎接建黨90周年、向黨的十八大獻禮兩個重大節(jié)點推進展開。本次活動期間跨度2010-2012年的三個學(xué)年、六個學(xué)期。整個活動分四個步驟進行。
(一)動員部署、學(xué)習(xí)準備階段(2010年4月—6月底)。主要抓好四項工作:
1、動員部署。學(xué)院黨委召開動員大會,進行工作部署。
2、制定方案。學(xué)院黨委圍繞學(xué)校創(chuàng)先爭優(yōu)活動的主題、載體、重點和總體要求,從本單位實際情況出發(fā),制定切實可行的活動實施方案;黨員要圍繞黨性修養(yǎng)、作風(fēng)養(yǎng)成、履行職責(zé)、崗位奉獻等方面提出參加活動的具體打算。學(xué)院黨委、黨支部的活動方案和黨員個人的具體打算要采取會議、網(wǎng)絡(luò)、活動專欄等方式向群眾公布,重點做出承-2-
諾,接受群眾監(jiān)督。
3、組織學(xué)習(xí)。各黨支部組織黨員認真學(xué)習(xí)胡錦濤總書記在全黨深入學(xué)習(xí)實踐科學(xué)發(fā)展觀活動總結(jié)大會上的重要講話及學(xué)校相關(guān)文件精神,統(tǒng)一思想認識,積極投入到創(chuàng)先爭優(yōu)活動中來。
4、黨性分析。各黨支部在2010年春季學(xué)期結(jié)束前,集中一周時間,組織黨員進行一次黨性分析,在職黨員應(yīng)撰寫黨性分析報告,并組織群眾對黨員進行評議。
(二)全面創(chuàng)爭、扎實推進階段(2010年9月—2011年6月底)。學(xué)院黨委、黨支部和黨員根據(jù)實施方案和個人具體打算,緊密結(jié)合實際工作,認真扎實、機動靈活地開展創(chuàng)先爭優(yōu)活動。具體圍繞幾項主題活動展開:
1、“師德教育”活動。在教師節(jié)前后,對教職工黨員普遍進行師德師風(fēng)教育,對學(xué)生黨員進行優(yōu)良校風(fēng)學(xué)風(fēng)教育,促使一批優(yōu)秀共產(chǎn)黨員成為“三育人”標兵、師德標兵或?qū)W生標兵。
2、“崗位奉獻”活動。從新學(xué)期開學(xué)開始,配合學(xué)校開展“211”建設(shè)先鋒、新海大創(chuàng)建標兵、海大之星等推選評比活動。
3、“服務(wù)群眾”活動。各黨支部組織黨員走向基層、走向社會,開展志愿服務(wù)、結(jié)對幫扶、走訪慰問等活動;合理利用寒暑假時間,搞好調(diào)查研究和社會服務(wù),使黨員在聯(lián)系基層、奉獻社會的過程中增強責(zé)任感、使命感。
4、“亮牌示范”活動。通過設(shè)置黨員先鋒崗、示范崗或掛牌上崗等形式,樹立黨員形象,促使黨員發(fā)揮骨干、先鋒模范作用。
5、“強基創(chuàng)先”活動。優(yōu)化組織設(shè)置,創(chuàng)新組織形式和活動方式,加強黨組織班子、制度建設(shè),強化組織功能,推動創(chuàng)新發(fā)展,真正發(fā)揮學(xué)院黨組織的政治保證、戰(zhàn)斗堡壘作用,努力提高學(xué)院黨組織建設(shè)的科學(xué)化水平。
2011年“七一”前,向?qū)W校黨委推薦表彰先進黨組織、優(yōu)秀共產(chǎn)黨員和優(yōu)秀黨務(wù)工作者。
(三)典型帶動、全面提升階段(2011年9月—2012年6月底)。充分發(fā)揮先進典型的示范帶動作用,全面提升活動的整體工作水平。主要抓好三項工作:
1、樹立先進典型。學(xué)校將確定一批“五個好”先進基層黨組織和“五個模范”優(yōu)秀黨員、優(yōu)秀黨務(wù)工作者,采取組織先進典型報告會、觀摩學(xué)習(xí)、宣傳報道等形式,擴大先進典型影響力。
2、開展向先進典型學(xué)習(xí)活動。各黨支部和全體黨員,都要對照先進典型,對照目標要求和崗位職責(zé),查找自身差距,明確努力方向,制定跟進、趕超的具體措施。
3、實施全面提升工程。對照總體要求,著眼全面提升,進一步加強黨組織建設(shè),促進提升“五個好”先進基層黨組織和“五個模范”優(yōu)秀黨員、優(yōu)秀黨務(wù)工作者的比例。
2012年“七一”前,學(xué)校將根據(jù)上級組織部署,推薦表彰“2010—2012年創(chuàng)先爭優(yōu)活動”先進基層黨組織、優(yōu)秀共產(chǎn)黨員、優(yōu)秀黨務(wù)工作者。
(四)回顧總結(jié)、完善機制階段(2012年9月——黨的十八大召開前)。圍繞向黨的十八大獻禮,這一階段重點抓好四項工作:
1、展示成果。配合學(xué)校開展集中展示活動成果活動。
2、搞好總結(jié)。學(xué)院黨委對開展創(chuàng)先爭優(yōu)活動進行系統(tǒng)總結(jié),認真總結(jié)經(jīng)驗、查找不足,進一步研究制定改進措施。
3、考核評議。學(xué)校黨委對學(xué)院黨委、黨支部、黨員開展創(chuàng)先爭優(yōu)活動情況進行考核,并采取適當方式組織黨員、群眾進行評議。
4、完善機制。對開展創(chuàng)先爭優(yōu)活動中行之有效的科學(xué)做法用制度的形式固定下來,形成創(chuàng)先爭優(yōu)的長效機制。
四、組織領(lǐng)導(dǎo)
學(xué)院成立創(chuàng)先爭優(yōu)活動領(lǐng)導(dǎo)小組,在校黨委指導(dǎo)、院黨委領(lǐng)導(dǎo)下開展具體工作。各黨支部為活動的落實單位,負責(zé)具體的學(xué)習(xí)、黨內(nèi)分析、主題活動、總結(jié)評議等工作。
1、領(lǐng)導(dǎo)小組成員包括:組長:沈秀清;副組長:崔昌華;成員:全體黨委委員、綜合辦主任、各黨支部書記。
2、按照校黨委的要求,學(xué)院創(chuàng)先爭優(yōu)活動要堅持服務(wù)大局,圍繞科教中心工作、密切聯(lián)系群眾、經(jīng)常性為主的原則,并努力形成學(xué)習(xí)先進、崇尚先進、爭當先進的活動氛圍和風(fēng)氣。
3、各黨支部要組織好各項具體工作,結(jié)合實際,力求實效,以創(chuàng)先爭優(yōu)活動的成果推進學(xué)院黨的建設(shè)和各項工作,促進學(xué)院又好又快發(fā)展。
環(huán)境與植物保護學(xué)院黨委
2010年5月31日
第二篇:vb圖書管理系統(tǒng)源代碼
Borbook:
Public sqltxt As String Public rno As String
'保存讀者借書證號 Public bno As String
'保存讀者圖書編號 Public xm As String
'保存讀者姓名 Public dw As String
'保存讀者單位 Public rs As ADODB.Recordset
Private Sub Comm1_Click()
rno = Trim(Text1(0).Text)
If rno = “" Then
MsgBox ”借書證號不能為空,請輸入“, vbOKOnly, ”信息提示“
Comm2.Enabled = False
Else
sqltxt = ”select * from reader where 借書證號='“ + rno + ”'“
Set rs = exesql(sqltxt)
If rs.RecordCount = 0 Then
MsgBox ”該讀者未登記,不能借書“, vbOKOnly, ”信息提示“
Comm2.Enabled = False
Else
Text2(0).Text = rs.Fields(”姓名“)
Text2(1).Text = str(rs.Fields(”借書總數(shù)“))
Text2(2).Text = str(rs.Fields(”借書總數(shù)“)rs.Fields(”已借書數(shù)“))
End If
End If
End If End Sub
Private Sub retCom_Click()
Unload Me End Sub
Private Sub Form_Load()
Comm2.Enabled = False End Sub
Edbook:
Private Sub DataGrid1_Click()
End Sub
Private Sub Form_Load()
'說明:為什么使用recs,而不直接使用adodc1.recordset.recordcount?在調(diào)用edbook1窗體添加一個記錄(確定)后,再
'返回到本表單,若不在Form_Activate()事件過程中調(diào)用adodc1.refresh進行刷新,adodc1.recordset.recordcount值
'仍未增1,這樣調(diào)用encomm過程時出錯;若在Form_Activate()事件過程中調(diào)用adodc1.refresh進行刷新,'adodc1.recordset.recordcount值增1了,調(diào)用encomm過程時也正確,但返回本窗體時,當前行總是第一行,顯然也不行,'因為用戶在添加或修改后希望在datagrid1中顯示當前操作的那條記錄.recs = Adodc1.Recordset.RecordCount End Sub
Private Sub Form_Activate()
DataGrid1.SetFocus
Call encomm End Sub
Private Sub Comm1_Click()
flag = 1
edbook1.Show vbModal End Sub
Private Sub Comm2_Click()
flag = 2
edbook1.Show vbModal End Sub
Private Sub Comm3_Click()
If MsgBox(”真的要刪除[“ + Trim(Adodc1.Recordset.Fields(”書名“))+ ”]嗎?“, vbYesNo, ”信息提示“)= vbYes Then
Adodc1.Recordset.Delete
recs = recs1
Call encomm
End If End Sub
Private Sub Comm4_Click()
Unload Me End Sub
Private Sub encomm()
If recs = 0 Then
Comm2.Enabled = False
Comm3.Enabled = False
Else
Comm2.Enabled = True
Comm3.Enabled = True
End If End Sub
Edlev1:
Dim cond As String
Private Sub Form_Load()
If flag = 2 Then
Text1(0).Text = edlev.Adodc1.Recordset.Fields(”級別“)
Text1(1).Text = edlev.Adodc1.Recordset.Fields(”過期罰款“)
Text1(2).Text = edlev.Adodc1.Recordset.Fields(”借書總數(shù)“)
Text1(3).Text = edlev.Adodc1.Recordset.Fields(”借書天數(shù)“)
End If End Sub
Private Sub Comm1_Click()
If Trim(Text1(0).Text)= ”“ Or Trim(Text1(1).Text)= ”“ Or Trim(Text1(2).Text)= ”“ Or _
Trim(Text1(3).Text)= ”“ Then
MsgBox ”數(shù)據(jù)項不全,請重新設(shè)置“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
If flag = 1 Then '添加操作
If edlev.Adodc1.Recordset.RecordCount > 0 Then '原記錄個數(shù)大于0
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
edlev.Adodc1.Recordset.MoveFirst
'每次從頭開始查找
edlev.Adodc1.Recordset.Find(cond)
If Not edlev.Adodc1.Recordset.EOF()Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
End If
edlev.Adodc1.Recordset.AddNew
edlev.Adodc1.Recordset.Fields(”級別“)= Trim(Text1(0).Text)
edlev.Adodc1.Recordset.Fields(”過期罰款“)= Val(Trim(Text1(1).Text))
edlev.Adodc1.Recordset.Fields(”借書總數(shù)“)= Val(Trim(Text1(2).Text))
edlev.Adodc1.Recordset.Fields(”借書天數(shù)“)= Val(Trim(Text1(3).Text))
edlev.Adodc1.Recordset.Update
recs = recs + 1
Else
'修改操作
n = edlev.Adodc1.Recordset.AbsolutePosition
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
edlev.Adodc1.Recordset.MoveFirst '每次從頭開始查找
edlev.Adodc1.Recordset.Find(cond)
If Not edlev.Adodc1.Recordset.EOF()And edlev.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
edlev.Adodc1.Recordset.MoveFirst
'這兩個語句恢復(fù)原記錄位置
edlev.Adodc1.Recordset.Move(n1)
edlev.Adodc1.Recordset.Fields(”級別“)= Trim(Text1(0).Text)
edlev.Adodc1.Recordset.Fields(”過期罰款“)= Val(Trim(Text1(1).Text))
edlev.Adodc1.Recordset.Fields(”借書總數(shù)“)= Val(Trim(Text1(2).Text))
edlev.Adodc1.Recordset.Fields(”借書天數(shù)“)= Val(Trim(Text1(3).Text))
edlev.Adodc1.Recordset.Update
End If
Unload Me End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Edreader:
Private Sub DataGrid1_Click()
End Sub
Private Sub Form_Load()
recs = Adodc1.Recordset.RecordCount End Sub
Private Sub Form_Activate()
DataGrid1.SetFocus
Call encomm End Sub
Private Sub Comm1_Click()
flag = 1
edreader1.Show vbModal End Sub
Private Sub Comm2_Click()
flag = 2
edreader1.Show vbModal End Sub
Private Sub Comm3_Click()
If MsgBox(”真的要刪除[“ + Trim(Adodc1.Recordset.Fields(”姓名“))+ ”]嗎?“, vbYesNo, ”信息提示“)= vbYes Then
Adodc1.Recordset.Delete
recs = recs1
Call encomm
End If End Sub Private Sub Comm4_Click()
Adodc1.Recordset.UpdateBatch
Adodc1.Recordset.Close
Unload Me End Sub Private Sub encomm()
If recs = 0 Then
Comm2.Enabled = False
Comm3.Enabled = False
Else
Comm2.Enabled = True
Comm3.Enabled = True
End If End Sub
Edrec1:
Dim cond As String
Private Sub Form_Load()
Label1.Caption = cap
If flag = 1 Then
Text1.Text = ”“
Else
Text1.Text = edrec.Adodc1.Recordset.Fields(”fn“)
End If End Sub
Private Sub Comm1_Click()
If Trim(Text1.Text)= ”“ Then
MsgBox ”數(shù)據(jù)項不能為空,請重新設(shè)置“, vbOKOnly, ”信息提示“
Text1.SetFocus
Exit Sub
End If
If flag = 1 Then '添加操作
If edrec.Adodc1.Recordset.RecordCount > 0 Then '原記錄個數(shù)大于0
cond = ”fn='“ + Trim(Text1.Text)+ ”'“
edrec.Adodc1.Recordset.MoveFirst
'每次從頭開始查找
edrec.Adodc1.Recordset.Find(cond)
If Not edrec.Adodc1.Recordset.EOF()Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
Text1.SetFocus
Exit Sub
End If
End If
edrec.Adodc1.Recordset.AddNew
edrec.Adodc1.Recordset.Fields(”fn“)= Trim(Text1.Text)
edrec.Adodc1.Recordset.Update
recs = recs + 1
Else
'修改操作
n = edrec.Adodc1.Recordset.AbsolutePosition
cond = ”fn='“ + Trim(Text1.Text)+ ”'“
edrec.Adodc1.Recordset.MoveFirst '每次從頭開始查找
edrec.Adodc1.Recordset.Find(cond)
If Not edrec.Adodc1.Recordset.EOF()And edrec.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
edrec.Adodc1.Recordset.MoveFirst
'這兩個語句恢復(fù)原記錄位置
edrec.Adodc1.Recordset.Move(n1)
edrec.Adodc1.Recordset.Fields(”fn“)= Trim(Text1.Text)
edrec.Adodc1.Recordset.Update
End If
Unload Me End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Menu:
Private Sub MDIForm_Load()
If Not userlevel = ”系統(tǒng)管理員“ Then
menu21.Enabled = False
menu31.Enabled = False
menu41.Enabled = False
menu42.Enabled = False
End If End Sub
Private Sub menu11_Click()
borbook.Show vbModal End Sub
Private Sub menu12_Click()
retbook.Show vbModal End Sub
Private Sub menu13_Click()
End End Sub
Private Sub menu21_Click()
edbook.Show vbModal End Sub
Private Sub menu22_Click()
qubook.Show vbModal End Sub
Private Sub menu31_Click()
edreader.Show vbModal End Sub
Private Sub menu32_Click()
qureader.Show vbModal End Sub
Private Sub menu41_Click()
setuser.Show vbModal End Sub
Private Sub menu42_Click()
If MsgBox(”本功能要清除系統(tǒng)中所有數(shù)據(jù),真的初始化嗎?“, vbYesNo, ”確認初始化操作“)
= vbYes Then
Call deldata(”book“)Call deldata(”reader“)Call deldata(”borrow“)Call deldata(”rlevel“)
Call deldata(”depart“)
Call deldata(”press“)
Call deldata(”oper“)
MsgBox ”系統(tǒng)初始化完畢,下次只能以1234/1234(用戶名/口令)進入本系統(tǒng)“, vbOKOnly, ”信息提示“
End If End Sub
Pass:
Public n As Integer
Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
txtsql = ”select * from oper where 用戶名='“ & _
Trim$(Text1(0).Text)& ”'“ & ” And 口令 = '“ & Trim$(Text1(1).Text)+ ”'“
Set mrc = exesql(txtsql)
If mrc.RecordCount = 0 Then '未找到用戶記錄
n = n + 1
If n < 3 Then
MsgBox ”沒有這個用戶,繼續(xù)登錄“, vbOKOnly + vbExclamation, ”信息提示“
Text1(0).Text = ”“
Text1(1).Text = ”“
Text1(0).SetFocus
Else
MsgBox ”已登錄失敗三次,退出系統(tǒng)“, vbOKOnly + vbExclamation, ”信息提示“
mrc.Close
Unload Me
End If
Else
'找到合法用戶記錄
userlevel = Trim(mrc.Fields(”級別“))
mrc.Close
Unload Me
menu.Show '調(diào)用menu窗體
End If End Sub
Private Sub Command2_Click()
Unload Me End Sub
Private Sub Form_Load()
n = 0
'n保存登錄的次數(shù) End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
Qubook:
Private Sub Comm1_Click()
Dim sqltxt As String
If Adodc1.Recordset.Fields(”借否“)= ”借“ Then
no = Trim(Adodc1.Recordset.Fields(”圖書編號“))
sqltxt = ”select * from borrow where 圖書編號='“ + no + ”'“
Set rs = exesql(sqltxt)
If rs.RecordCount = 0 Then
MsgBox ”該圖書沒有借書記錄“, vbOKOnly, ”信息提示“
Else
MsgBox ”圖書編號:“ + no + Chr(10)+ Chr(13)+ _
”書
名:“ + Trim(rs.Fields(”書名“))+ Chr(10)+ Chr(13)+ _
”借 書 人:“ + Trim(rs.Fields(”姓名“))+ Chr(10)+ Chr(13)+ _
”單
位:“ + Trim(rs.Fields(”單位“))+ Chr(10)+ Chr(13)+ _
”借書日期:“ + Format(rs.Fields(”借書日期“), ”yyyy.mm.dd“), vbOKOnly, ”查找結(jié)果“
End If
rs.Close
Else
MsgBox ”該書沒有外借,不能顯示借書人“, vbOKOnly, ”信息提示“
End If End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Private Sub Form_Activate()
Adodc1.Refresh
DataGrid1.Refresh
DataGrid1.SetFocus
Call encomm End Sub
Private Sub selcmd1_Click()'設(shè)置條件確定
Dim str As String
str = ”“
'條件表達式
If Trim(Text1(0).Text)<> ”“ Then
If str = ”“ Then
str = ”圖書編號='“ + Trim(Text1(0).Text)+ ”'“
Else
str = str + ” and 圖書編號='“ + Trim(Text1(0).Text)+ ”'“
End If
End If
If Trim(Text1(1).Text)<> ”“ Then
If str = ”“ Then
str = ”書名='“ + Trim(Text1(1).Text)+ ”'“
Else
str = str + ” and 書名='“ + Trim(Text1(1).Text)+ ”'“
End If
End If
If Trim(Text1(2).Text)<> ”“ Then
If str = ”“ Then
str = ”作者='“ + Trim(Text1(2).Text)+ ”'“
Else
str = str + ” and 作者='“ + Trim(Text1(2).Text)+ ”'“
End If
End If
If Trim(Text1(3).Text)<> ”“ Then
If str = ”“ Then
str = ”出版社='“ + Trim(Text1(3).Text)+ ”'“
Else
str = str + ” and 出版社='“ + Trim(Text1(3).Text)+ ”'“
End If
End If
If Trim(Text1(4).Text)<> ”“ Then
If str = ”“ Then
str = ”借否='“ + Trim(Text1(4).Text)+ ”'“
Else
str = str + ” and 借否='“ + Trim(Text1(4).Text)+ ”'“
End If
End If
If Trim(Text1(5).Text)<> ”“ Then
If str = ”“ Then
str = ”定價=“ + Trim(Text1(5).Text)
Else
str = str + ” and 定價=“ + Trim(Text1(5).Text)
End If
End If
If str <> ”“ Then
Adodc1.RecordSource = ”select * from book where “ + str
Adodc1.Refresh
Else
Adodc1.RecordSource = ”select * from book“
Adodc1.Refresh
End If
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox ”沒有任何滿足條件的記錄“, vbOKOnly, ”信息提示“
End If
Call encomm End Sub
Private Sub selcmd2_Click()'設(shè)置條件重置
Text1(0).Text = ”“
Text1(1).Text = ”“
Text1(2).Text = ”“
Text1(3).Text = ”“
Text1(4).Text = ”“
Text1(5).Text = ”“ End Sub
Private Sub encomm()'自定義子過程:判斷Adodc1中是否存在記錄
If Adodc1.Recordset.RecordCount = 0 Then
Comm1.Enabled = False
Else
Comm1.Enabled = True
End If End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
Qureader:
Private Sub Comm1_Click()
Dim strn As String
Dim sqltxt As String
no = Trim(Adodc1.Recordset.Fields(”借書證號“))
sqltxt = ”select * from borrow where 借書證號='“ + no + ”'“
Set rs = exesql(sqltxt)
If rs.RecordCount = 0 Then
MsgBox ”該讀者沒有借任何圖書“, vbOKOnly, ”信息提示“
Else
rs.MoveFirst
strn = ”書
名(借書日期)“ + Chr(10)+ Chr(13)
Do While Not rs.EOF()
strn = strn & Trim(rs.Fields(”書名“))& ”(“ & Format(rs.Fields(”借書日期“), ”yyyy.mm.dd“)& ”)“ + Chr(10)+ Chr(13)
rs.MoveNext
Loop
MsgBox strn, vbOKOnly, ”列所借圖書清單“
rs.Close
End If End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Private Sub Form_Activate()
Adodc1.Refresh
DataGrid1.Refresh
DataGrid1.SetFocus
Call encomm End Sub
Private Sub selcmd1_Click()'設(shè)置條件確定
Dim str As String
str = ”“
'條件表達式
If Trim(Text1(0).Text)<> ”“ Then
If str = ”“ Then
str = ”借書證號='“ + Trim(Text1(0).Text)+ ”'“
Else
str = str + ” and 借書證號='“ + Trim(Text1(0).Text)+ ”'“
End If
End If
If Trim(Text1(1).Text)<> ”“ Then
If str = ”“ Then
str = ”姓名='“ + Trim(Text1(1).Text)+ ”'“
Else
str = str + ” and 姓名='“ + Trim(Text1(1).Text)+ ”'“
End If
End If
If Trim(Text1(2).Text)<> ”“ Then
If str = ”“ Then
str = ”單位='“ + Trim(Text1(2).Text)+ ”'“
Else
str = str + ” and 單位='“ + Trim(Text1(2).Text)+ ”'“
End If
End If
If Trim(Text1(3).Text)<> ”“ Then
If str = ”“ Then
str = ”級別='“ + Trim(Text1(3).Text)+ ”'“
Else
str = str + ” and 級別='“ + Trim(Text1(3).Text)+ ”'“
End If
End If
If Trim(Text1(4).Text)<> ”“ Then
If str = ”“ Then
str = ”性別='“ + Trim(Text1(4).Text)+ ”'“
Else
str = str + ” and 性別='“ + Trim(Text1(4).Text)+ ”'“
End If
End If
If str <> ”“ Then
Adodc1.RecordSource = ”select * from reader where “ + str
Adodc1.Refresh
Else
Adodc1.RecordSource = ”select * from reader“
Adodc1.Refresh
End If
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox ”沒有任何滿足條件的記錄“, vbOKOnly, ”信息提示“
End If
Call encomm End Sub
Private Sub selcmd2_Click()'設(shè)置條件重置
Text1(0).Text = ”“
Text1(1).Text = ”“
Text1(2).Text = ”“
Text1(3).Text = ”“
Text1(4).Text = ”“ End Sub
Private Sub encomm()'自定義子過程:判斷Adodc1中是否存在記錄
If Adodc1.Recordset.RecordCount = 0 Then
Comm1.Enabled = False
Else
Comm1.Enabled = True
End If End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
Retbook:
Public rno As String Public bno As String
Private Sub Comm1_Click()
bno = Trim(Text1.Text)
If bno <> ”“ Then
Dim sqltxt As String
sqltxt = ”select * from borrow where 圖書編號='“ + bno + ”'“
Set brs = exesql(sqltxt)
If brs.RecordCount = 0 Then
MsgBox ”該書不是從本圖書館所借的,不能歸還!“, vbOKOnly, ”信息提示“
Else
If Trim(brs.Fields(”借書證號“))<> rno Then
If rno <> ”“ Then
'另一讀者還書,自動列出上一個還書人的罰款單
dstr = ”罰款單“ + Chr(10)+ Chr(13)
dstr = dstr & ”姓名:“ & Trim(Text2(1).Text)+ ”(“ + rno + ”)罰款總額:“ & str(Text2(4).Text)& ”元“
MsgBox dstr, vbOKOnly, ”列罰款單“
End If
rno = Trim(brs.Fields(”借書證號“))
sqltxt = ”select * from book where 圖書編號='“ + bno + ”'“ '處理圖書記錄
Set bs = exesql(sqltxt)
bs.Fields(”借否“)= ”否“
bs.Update
sqltxt = ”select * from reader where 借書證號='“ + rno + ”'“ '處理讀者記錄
Set rs = exesql(sqltxt)
rs.Fields(”已借書數(shù)“)= rs.Fields(”已借書數(shù)“)rs.Fields(”已借書數(shù)“)
If(Datebrs.Fields(”借書日期“)1
rs.Update
If(Datebrs.Fields(”借書日期“)1
Call encomm
End If End Sub
Private Sub Comm4_Click()
Unload Me End Sub
Private Sub encomm()
If recs = 0 Then
Comm2.Enabled = False
Comm3.Enabled = False
Else
Comm2.Enabled = True
Comm3.Enabled = True
End If End Sub
Setuser1:
Dim cond As String
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys ”{TAB}“
End If End Sub
Private Sub Form_Load()
If flag = 2 Then
Text1(0).Text = setuser.Adodc1.Recordset.Fields(”用戶名“)
Text1(1).Text = setuser.Adodc1.Recordset.Fields(”口令“)
Combo1.Text = setuser.Adodc1.Recordset.Fields(”級別“)
End If End Sub
Private Sub Comm1_Click()
If Trim(Text1(0).Text)= ”“ Or Trim(Text1(1).Text)= ”“ Or Trim(Combo1.Text)= ”“ Then
MsgBox ”數(shù)據(jù)項不全,請重新設(shè)置“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
If flag = 1 Then '添加操作
If setuser.Adodc1.Recordset.RecordCount > 0 Then '原記錄個數(shù)大于0
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
setuser.Adodc1.Recordset.MoveFirst
'每次從頭開始查找
setuser.Adodc1.Recordset.Find(cond)
If Not setuser.Adodc1.Recordset.EOF()Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
Text1(0).SetFocus
Exit Sub
End If
End If
setuser.Adodc1.Recordset.AddNew
setuser.Adodc1.Recordset.Fields(”用戶名“)= Trim(Text1(0).Text)
setuser.Adodc1.Recordset.Fields(”口令“)= Val(Trim(Text1(1).Text))
setuser.Adodc1.Recordset.Fields(”級別“)= Trim(Combo1.Text)
setuser.Adodc1.Recordset.Update
recs = recs + 1
Else
'修改操作
n = setuser.Adodc1.Recordset.AbsolutePosition
cond = ”級別='“ + Trim(Text1(0).Text)+ ”'“
setuser.Adodc1.Recordset.MoveFirst '每次從頭開始查找
setuser.Adodc1.Recordset.Find(cond)
If Not setuser.Adodc1.Recordset.EOF()And setuser.Adodc1.Recordset.AbsolutePosition <> n Then
MsgBox ”存在完全相同的記錄“, vbOKOnly, ”信息提示“
setuser.Adodc1.Recordset.MoveFirst
'這兩個語句恢復(fù)原記錄位置
setuser.Adodc1.Recordset.Move(n1)
setuser.Adodc1.Recordset.Fields(”用戶名“)= Trim(Text1(0).Text)
setuser.Adodc1.Recordset.Fields(”口令“)= Val(Trim(Text1(1).Text))
setuser.Adodc1.Recordset.Fields(”級別“)= Trim(Combo1.Text)
setuser.Adodc1.Recordset.Update
End If
Unload Me End Sub
Private Sub Comm2_Click()
Unload Me End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Call endata(KeyAscii)End Sub
模塊:
Public userlevel As String '保存用戶級別
Public flag As Integer
'用作記錄操作標記
Public tna As String
'保存表名:用于調(diào)用edrec1窗體 Public cap As String
'保存標題名:用于調(diào)用edrec1窗體 Public recs As Integer
'保存記錄集中記錄個數(shù)
Sub main()
pass.Show vbModal End Sub
Public Function exesql(ByVal sql As String)As ADODB.Recordset
sql = Trim$(sql)
Set conn = New ADODB.Connection
Set rst = New ADODB.Recordset
conn.ConnectionString = ”DSN=Library;UID=sa;PWD=;“
conn.Open
Set rst.ActiveConnection = conn
rst.LockType = adLockOptimistic
rst.CursorType = adOpenKeyset
rst.Open sql
Set exesql = rst
Set rst = Nothing
Set conn = Nothing End Function
Public Sub deldata(ByVal tn As String)刪除指定表中所有記錄,對于oper表添加一個系統(tǒng)用戶
Dim sql As String
sql = ”delete “ & Trim$(tn)
Set conn = New ADODB.Connection
conn.ConnectionString = ”DSN=Library;UID=sa;PWD=;“
conn.Open
conn.Execute sql
If Trim(tn)= ”oper“ Then
sql = ”insert oper values('1234','1234','系統(tǒng)管理員')“
conn.Execute sql
End If
conn.Close End Sub Public Sub endata(Keyasc As Integer)
If Keyasc = 13 Then
SendKeys ”{TAB}" '將回車鍵轉(zhuǎn)換成Tab鍵
End If End Sub
第三篇:圖書管理系統(tǒng)數(shù)據(jù)庫源代碼
圖書管理系統(tǒng)數(shù)據(jù)庫源代碼
//創(chuàng)建工程及設(shè)計主界面
public class Main extends JFrame { private static final JDesktopPane {
DESKTOP_PANE=new JDesktopPane();
//桌面窗體
} public static void main(String[] args)
//入口方法
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());//設(shè)置系統(tǒng)界面外觀
new BookLogin();
//登錄窗口
}
catch(Exception ex)
{
ex.printStackTrace();
} } public static void addIFame(JInternalFrame iframe)
//添加子窗體的方法
{
DESKTOP_PANE.add(iframe);
//新增子窗體
} public Main(){
super();
//設(shè)置“關(guān)閉”按鈕處理事件
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
//創(chuàng)建工具欄
Toolkit tool=Toolkit,getDefaultToolkit();
//獲得屏幕大小
Dimension screenSize=tool.getScreenSize();
setSize(800,600);
//設(shè)置窗體大小
setLocation((screenSize.width-getWidth())/2,(screenSize.height-getHeight())/2;//設(shè)置窗體位置
setTitle(“圖書管理系統(tǒng)”);
//設(shè)置窗體標題
JMenuBar menuBar=createMenu();
//創(chuàng)建菜單欄
setJMenuBar(menuBar);
//設(shè)置菜單欄
JToolBar toolBar=createToolBar();
//創(chuàng)建工具欄的方法
getContentPane(),add(toolBar,BorderLayout.NORTH);
//設(shè)置工具欄
final JLable lable=new JLable();
//創(chuàng)建一個標簽,用來顯示圖片
lable.setBounds(0,0,0,0);
//設(shè)置窗體的大小和位置
lable.setIcon(null);
//窗體背景
DESKTOP_PANE.addComponentListener(new ComponentAdapter())
{
public void componentResized(final ComponentEvent e)
{
Dimension size=e.getComponent().getSize();
//獲得組建大小
lable.setSize(e.getComponent().getSize());
//設(shè)置標簽大小
lable.setText(“”);
//設(shè)置標簽文本,設(shè)置窗口背景
}
}
//將標簽添加到桌面窗體
DESKTOP_PANE.add(lable,new Integer(Integer.MIN_VALUE));
getContentPane().add(DESKTOP_PANE);
//將桌面窗體添加到主窗體中
} } private JToolBar createToolBar()
//創(chuàng)建工具欄的方法 { JToolBar toolBar=new JToolBar();
//初始化工具欄
toolBar.setFloatable(false);
//設(shè)置是否可以移動工具欄
toolBar.setBorder(new BevelBorder(BevelBorder.RAIZED));
//設(shè)置邊框
//圖書信息添加按鈕
JButton bookAddButton=new JButton(MenuActions.BOOK_ADD);ImageIcon icon=new ImageIcon(Main.class.getResource(“/bookAddtb.jpg”));//添加菜單欄圖標
bookAddButton.setIcon(icon);
//設(shè)置按鈕圖標
bookAddButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookAddButton);
//添加到工具欄中
JButton bookModiAndDelButton=new JButton(MenuActions.BOOK_MODIFY);
//圖書信息修改按鈕
ImageIcon bookmodiicon=Icon.add(“bookModiAndDeltb.jpg”);
//創(chuàng)建圖表方法
bookModiAndDelButton.setIcon(bookmodiicon);
//設(shè)置按鈕圖標
bookModiAndDelButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookModiAndDelButton);
//添加到工具欄
JButton bookTypeAddButton=new JButton(MenuActions.BOOKTYPE_ADD);
//圖書類別添加按鈕
ImageIcon bookTypeAddicon=Icon.add(“bookTypeAddtb.jpg”);
//創(chuàng)建圖標方法
bookTypeAddButton.setIcon(bookTypeAddicon);
//設(shè)置按鈕圖標
bookTypeAddButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookTypeAddButton);
//添加到工具欄
JButton bookBorrowButton=new JButton(MenuActions.BORROW);
//圖書借閱按鈕
ImageIcon bookBorrowicon=Icon.add(“bookBorrowtb.jpg”);
//創(chuàng)建圖標方法
bookBorrowButton.setIcon(bookBorrowicon);
//設(shè)置按鈕圖標
bookBorrowButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookBorrowButton);
//添加到工具欄
JButton bookOrderButton=new JButton(MenuActions.NEWBOOK_ORDER);
//新書訂購按鈕
ImageIcon bookOrdericon=Icon.add(“bookOrdertb.jpg”);
//創(chuàng)建圖標方法
bookOrderButton.setIcon(bookOrdericon);
//設(shè)置按鈕圖標
bookOrderButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookOrderButton);
//添加到工具欄
JButton bookCheckButton=new JButton(MenuActions.NEWBOOK_CHECK);
//驗收新書按鈕
ImageIcon bookCheckicon=Icon.add(“newbookChecktb.jpg”);
//創(chuàng)建圖標方法
bookCheckButton.setIcon(bookCheckicon);
//設(shè)置按鈕圖標
bookCheckButton.setHideActionText(true);
//顯示提示文本
toolBar.add(bookCheckButton);
//添加到工具欄
JButton readerAddButton=new JButton(MenuActions.READER_ADD);
//讀者信息添加按鈕
ImageIcon readerAddicon=Icon.add(“readerAddtb.jpg”);
//創(chuàng)建圖標方法
readerAddButton.setIcon(readerAddicon);
//設(shè)置按鈕圖標
readerAddButton.setHideActionText(true);
//顯示提示文本
toolBar.add(readerAddButton);
//添加到工具欄
JButton readerModiAndDelButton=new JButton(MenuActions.READER_MODIFY);
//讀者信息修改按鈕
ImageIcon readerModiAndDelicon=Icon.add(“readerModiAndDeltb.jpg”);
//創(chuàng)建圖標方法
readerModiAndDelButton.setIcon(readerModiAndDelicon);
//設(shè)置按鈕圖標
readerModiAndDelButton.setHideActionText(true);
//顯示提示文本
toolBar.add(readerModiAndDelButton);
//添加到工具欄
JButton ExitButton=new JButton(MenuActions.EXIT);
//退出系統(tǒng)按鈕
ImageIcon Exiticon=Icon.add(“exittb.jpg”);
//創(chuàng)建圖標方法
ExitButton.setIcon(Exiticon);
//設(shè)置按鈕圖標
ExitButton.setHideActionText(true);
//顯示提示文本
toolBar.add(ExitButton);
//添加到工具欄
return toolBar;} public class Business { protected static String dbClassName=“com.mysql.jdbc.Driver”;
//數(shù)據(jù)庫驅(qū)動類
protected static String dbUr1=“jdbc:mysql://localhost/ts”;
//連接URL protected static String dbUser=“root”;
//數(shù)據(jù)庫用戶名
protected static String dbpwd=“root”;
//數(shù)據(jù)庫密碼
private static Connection conn=null;
//數(shù)據(jù)庫連接對象,初值為null public Business(){
try
{
if(coon==null)
//連接對象為空
{
Class.forName(dbClassName);
//加載驅(qū)動類信息
conn=DriverManager.getConnection(dbUr1,dbUser,dbPwd);
//建立連接對象
}
}
catch(Exception ee)
{
ee.printStackTrace();
} } public static ResultSet executeQuery(String sql)
//執(zhí)行查詢方法
{
try
{
//如果連接對象為空,則重新調(diào)用構(gòu)造方法
if(conn==null)
{
new Business();
return conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE).executeQuery(sql);
//執(zhí)行查詢
}
}
catch(SQLException e)
{
e.printStackTrace();
return null;
//返回null值
}
finally
{} } public static int executeUpdata(String sql)
//更新方法
{
try
{
if(conn==null)
{
new Business();
//如果連接對象為空,則重新調(diào)用構(gòu)造方法
return conn.createStatement().executeUpdate(sql);//執(zhí)行更新
}
}
catch(SQLException e)
{
e.printStackTrace();
return-1;
}
finally
{} } public static void close()
//關(guān)閉方法 {
try
{
conn.close();
//關(guān)閉連接對象
}
catch(SQLException e)
{
e.printStackTrace();
}
finally
{
conn=null;
//設(shè)置連接對象為null值
} } }
//為數(shù)據(jù)庫添加對應(yīng)的類 public class BookInfo { private String Book_id;
//圖書編號
private String typeid;
//類別編號
private String writer;
//作者
private String translator;//譯者
private String publisher;
//出版社
private Date date;
//出版日期
private Double price;
//圖書單價
private String getBookname;//圖書名稱
public String getBookname(){
return bookname;} public void setBookname(String bookname){
this.bookname=bookname;} public Date getDate(){
return date;} public void setDate(Date date){
this.date=date;} public string getBook_id()
{ return Book_id;} public void setBook_id(String Book_id){ this.Book_id=Book_id;} public Double getPrice(){ return price;} public void setprice(Double price){ this.price=price;} public String getPublisher(){ return Publisher;} public void setPublisher(String publisher){ this.Publisher=Publisher;} public String getTranslator(){ return translator;} public void setTranslator(String translator){ this.translator=translator;} public String getTypeid(){ return typeid;} public void setTypeid(String typeid){ this.typeid=typeid;} public String getWriter(){ return writer;} public void setWriter(String writer){
this.writer=writer;} } public class BookType
//圖書列表信息類 { private String id;
//圖書類別編號
private String typeName;
//圖書類別名稱
private String days;
//可解天數(shù)
private String fk;//每罰款金額
public String getFk(){
return fk;} public void setFk(String fk){
this.fk=fk;} public String getDays(){
return days;} public void setDays(String days){
this.days=days;} public string getId(){
return id;} public void setId(String id){
this.Bid=id;} public String getTypeName(){
return typeName;} public void setTypeName(String typeName){
this.typeName=typeName;} } public class Order
//圖書訂單信息類 {
private String Book_id;
//圖書編號 private Date date;
//下單時間 private String number;
//圖書數(shù)量 private String operator;//操作員
private String checkAndAccept;
//是否收到貨 private String zk;
//圖書折扣 public String getcheckAndAccept(){ return checkAndAccept;} public void setcheckAndAccept(String checkAndAccept){ this.checkAndAccept=checkAndAccept;} public Date getDate(){ return date;} public void setDate(Date date){ this.date=date;} public string getBook_id(){ return book_id;} public void setBook_id(String book_id){ this.book_id=book_id;} public String getNumber(){ return number;} public void setNumber(String number){ this.number=number;} public String getOperator(){ return operator;} public void setOperator(String operator){
this.operatorr=operator;
} public String getZk(){
return zk;} public void setZk(String Zk){
this.zk=zk;} } public class Operater { private String id;
//操作員編號
private String name;
//操作員用戶名
private String grade;
//操作員等級
private String password;//操作員密碼
private String type;
//出版社
public String getType(){
return type;} public void setType(String type){
this.type=type;} public string getGrade(){
return grade;} public void setGrade(String grade){
this.grade=grade;} public String getId(){
return id;} public void setId(String id){
this.id=id;} public String getName(){
return name;} public void setName(String name){
this.name=name;} public String getPassword(){
return password;} public void setPassword(String password){
this.password=password;} } public class Borrow
//書籍借閱信息類 { private int id;
//借閱編號
private String book_id;
//圖書編號
private String reader_id;
//讀者編號
private String num;
//借書數(shù)量
private String borrowDate;
//借書日期
private String backDate;
//應(yīng)還日期
private String Bookname;//圖書名稱
public String getBookname(){
return bookname;} public void setBookname(String bookname){
this.bookname=bookname;} public string getBackDate(){
return backDate;} public void setBackDate(String backDate){
this.backDate=backDate;} public string getBorrowDate(){
return borrowDate;} public void setBorrowDate(String borrowDate){
this.borrowDate=borrowDate;} public String getNum(){
return num;} public void setNum(String num){
this.num=num;} public String getBook_id(){
return book_id;} public void setBook_id(String book_id){
this.book_id=book_id;} public String getReader_id(){
return reader_id;} public void setReader_id(String reader_id){
this.reader_id=reader_id;} public int getId(){
return id;} public void setId(Int id){
this.id=id;} } public class Back
//圖書歸還信息類 { private String book_id;
//圖書編號
private String bookname;
//圖書名稱
private String operatorId;
//操作員編號
private String borrowDate;//圖書借閱時間
private String backDate;
//圖書歸還時間 private String readerName;
//讀者姓名 private String reader_id;//讀者編號 private int typeId;private int id; public int getId(){ return id;} public void setId(int id){ this.id=id;} public int getTypeId(){ return typeid;} public void setTypeId(int typeid){ this.typeId=typeId;} public string getBackDate(){ return backDate;} public void setBackDate(String backDate){ this.backDate=backDate;} public String getBookname(){ return bookname;} public void setBookname(String bookname){ this.bookname=bookname;} public string getBorrowDate(){ return borrowDate;} public void setBorrowDate(String borrowDate){ this.borrowDate=borrowDate;} public String getOperatorId(){
return operatorId;} public void setOperatorId(String operatorId){
this.operatorId=operatorId;} public String getBook_id(){
return book_id;} public void setBook_id(String book_id){
this.book_id=book_id;}
public String getReader_id(){
return reader_id;} public void setReader_id(String reader_id){
this.reader_id=reader_id;}
public String getReaderName(){
return readerName;} public void setReaderName(String readerName){
this.readerName=readerName;} }
//系統(tǒng)登錄模塊設(shè)計
public class BookLogin extends JFrame { private static final Operater Type=null;
//人員類型
private static Operater user;
//用戶名
private JPasswordField password;private JTextField username;private JButton login;private JButton reset;public BookLogin(){
super();
final BorderLayout borderLayout=new BorderLayout();
//創(chuàng)建布局管理器
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//設(shè)置“關(guān)閉”按鈕處理事件
borderLayout.setVgap(10);
//設(shè)置組件間的垂直關(guān)系
getContentPane().setLayout(borderLayout);
//使用布局管理器
setTitle(“圖書管理系統(tǒng)登錄”)
//設(shè)置窗體標題
Toolkit tool=Toolkit.getDefaultToolkit();
//獲得默認的工具箱
Dimension screenSize=tool.getScreenSize();//獲得屏幕的大小
setSize(285,194);
setLocation((screenSize.width-getWidth())/2,(screenSize.height-getHeight())/2);//設(shè)置窗體位置
final JPanel mainPanel=new JPanel();
//創(chuàng)建主面板
mainPanel.setLayout(new BorderLayout());
//設(shè)置邊框布局
mainPanel.setBorder(new EmptyBorder(0,0,0,0))
//設(shè)置邊框為0
getContentPane().add(mainPanel);
//在窗體中加入主面板
final JLabel imageLabel=new JLabel;
//創(chuàng)建一個標簽,用來顯示圖片
ImageIcon loginIcon=Icon.add(“l(fā)ogin.jpg”);
//創(chuàng)建一個圖像圖標
imagelabel.setIcon(loginIcon);
//設(shè)置圖片
imageLabel.setOpaque(true);
//設(shè)置繪制其邊界內(nèi)的所有像素
imageLabel.setBackground(Color.GREEN);
//設(shè)置背景顏色
imageLabel.setpreferredSize(new Dimension(260,60));//設(shè)置標簽大小
mainPanel.add(imageLabel,BorderLayout.NORTH);
//添加標簽到主面板
final JPanel centerPanel=new JPanel();
//添加一個中心面板
final GridLayout gridLayout=new GridLayout(2,2);//創(chuàng)建網(wǎng)絡(luò)布局管理器
gridLayout.setHgap(5);
//設(shè)置組件之間平行的距離
gridLayout.setVgap(20);
//設(shè)置組件之間垂直的距離
centerPanel.setLayout(gridLayout);
//使用布局管理器
mainPanel.add(centerPanel);
//添加到主桌面
final JLabel userNamelabel=new JLabel();
//創(chuàng)建一個標簽
userNameLabel.setHorizontalAlignment(SwingConstants.CENTER);//設(shè)置對齊方式
userNameLabel.setPreferredSize(new Dimension(0,0));
//設(shè)置組件大小
userNameLabel.setMinimumSize(new Dimension(0,0));
//設(shè)置組件最小的大小
centerPanel.add(userNameLabel);
//添加到中心面板
userNameLabel.setText(“用
戶
名:”);
//設(shè)置標簽文本
username=new JTextField(20);
//創(chuàng)建文本框
username.setPreferredSize(new Dimension(0,0));
//設(shè)置組件大小
centerPanel.add(username);
//添加到中心面板
final JLabel passwordLabel=new JLabel();
//創(chuàng)建一個標簽
passwordLabel.setHorizontalAlignment(SwingConstants.CENTER);
//設(shè)置對齊方式
centerPanel.add(passwordLabel);
//添加到中心面板
passwordLabel.setText(“密
碼:”);
//設(shè)置標簽文本
password=new JPasswordField(20);
//創(chuàng)建密碼框
password.setDocument(new Document(6));
//設(shè)置密碼長度為6
password.addKeyListener(new KeyAdapter()
//監(jiān)聽密碼框
{
public void keyPressed(final keyEvent e)
//監(jiān)聽鍵盤案件事件
{
if(e.getKeyCode()==10)
//如果按了回車鍵
{
login.doClick();
//進行登錄
}
}
})
centerPanel.add(password);
//添加到中心面板
final JPanel southPanel=new JPanel;//新增一個底部面板
mainPanel.add(southPanel,BorderLayout.SOUTH);
//添加到主面板中
login=new JButton();
//創(chuàng)建按鈕組件
login.addActionListener(new BookLoginAtion());
//添加監(jiān)聽器
login.setText(“登錄”);
//設(shè)置按鈕文本
southPanel.add(login);
//把按鈕添加到底部面板
reset=new JButton();
//創(chuàng)建按鈕組件
reset.addActionListener(new BookResetAction());
//添加監(jiān)聽器
reset.setText(“重置”);
//設(shè)置按鈕文本
southPanel.add(reset);
//把按鈕添加到底部面板
setVisible(true);
//設(shè)置創(chuàng)建可見
setResizable(false);
//設(shè)置窗體不可改變大小
} public static Operater getUser(){
return user;} public static Operater getType(){
return Type;} public static void setUser(Operater user){
BookLogin.user=user;} } private class BookResetAction implements ActionListener { public void actionPerformed(final ActionEvent e){
username.setText(“");//設(shè)置用戶名輸入框為空
password.setText(”“);//設(shè)置密碼輸入框為空
} } private class BookLoginAction implements ActionListener { public void actionPerformed(final ActionEvent e){
user=Business.check(username.getText(),new String(password.getPassword()));//調(diào)用business方法
if(user.getName()!=null)
//判斷用戶名是否為null
{
try
{
Main frame=new Main();
//創(chuàng)建一個主窗體
frame.setVisible(true);
//設(shè)置其可見
BookLogin.this.setVisible(false);
//設(shè)置登錄窗體為不顯示
}
catch(Exception ex)
{
ex.printStackTrace();
}
}
else
{
JOptionPane.showMessageDialog(null,”請輸入正確的用戶名和密碼!“);//彈出提示框
username.setText(”“);
//設(shè)置用戶名輸入框為空
password.setText(”“);
//設(shè)置密碼輸入框為空
} } }
//基本信息管理模塊
public class ReaderAdd extends JInternalFrame
//添加讀者信息 { public ReaderAdd(){
super();
setTitle(”讀者相關(guān)信息添加“);
setIconifiable(true);
//設(shè)置窗體可最小化
setClosable(true);
//設(shè)置窗體可關(guān)閉
setBounds(100,100,500,350);
final JLabel logoLabel=new JLabel();
ImageIcon readerAddIcon=Icon.add(”readerAdd.jpg“);
logoLabel.setIcon(readerAddIcon);
logoLabel.setOpaque(true);
logoLabel.setBackground(Color.CYAN);
logoLabel.setPreferredSize(new Dimension(400,60));
getContentPane().add(logoLabel,BorderLayout.NORTH);
final JPanel panel=new JPanel();
panel.setLayout(new FlowLayout());
getContentPane().add(panel);
final JPanel panel_1=new JPanel();
final GridLayout gridLayout=new GridLayout(0,4);
gridLayout.setVgap(15);
gridLayout.setHgap(15);
panel_1.setLayout(gridLayout);
panel_1.setPreferredSize(new Dimension(450,200));
panel.add(panel_1);
final JLabel label_2=new JLabel();
label_2.setText(”姓名:“);
panel_1.add(label_2);
readername=new JTextField();
readername.setDocument(new Document(10));
panel_1.add(readername);
final JLabel label_3=new JLabel();
public void actionPerformed(final ActionEvent e)
{
Check validator=new Check();
//校驗類
String zj=String.valueof(comboBox.getSelectedIndex());
String id=read_id.getText().trim();
Vector v1=new Vector();
v1.clear();
v1.add(”reader“);
//讀取配置文件中相應(yīng)的查詢語句
v1.add(id);
if(l==validator.Validate(V1))
//檢查是否存在該讀者
{
JOptionPane.showMessageDialog(null,”添加失敗,該讀者編號已存在!“);
}
else
{
Int i=Business.InsertReader(readername.getText().trim(),sex.trim(),age.getText().trim(),zjnumber.getText().trim(),Date.valueOf(date.getText().trim()),maxnumber.getText().trim().tel.getText().trim(),Double.valueof(keepmoney.getText().trim()),zj,zy.getText().trim(),Date.valueOf(bztime.getText().trim()),read_id.getText().trim());
if(i==1)
{
JOptionPane.showMessageDialog(null,”添加成功!“);
doDefaultCloseAction();
}
}
}
}
class TelListener extends KeyAdapter
{ public void keyTyped(KeyEvent e){
String numStr=”0123456789-“+(char)8;
//類型轉(zhuǎn)換
if(numStr.indexOf(e.getKeyChar())<0)
{
e.consume();
} }
}
//添加“關(guān)閉”按鈕的事件監(jiān)聽器
class CloseActionListener implements ActionListener
{
public void actionPerformed(final ActionEvent e)
{
doDefaultCloseAction();
}
}
private String[] columnNames(”名稱“,”性別“,”年齡“,”證件號碼“,”借書證有效日期“,”借書量“,”電話“,”押金“,”證件“,”職業(yè)“,”讀者編號“,”辦證時間“);
private String[] array=new String[]{”身份證“,”軍人證“,”學(xué)生證“};
String id;
private Object[][] getFileStates(List list)
{
Object[][]results=new Object[list.size()][columnNames.length];
for(int i=0;i { Reader reader=(Reader)list.get(i); result[i][0]=reader.getName(); //定義二維數(shù)組 String sex; if(reader.getSex().equals(”1“)) { sex=”男“; } else { sex=”女“; } results[i][1]=sex; //讀取讀者歌屬性值 results[i][2]=reader.getAge(); results[i][3]=reader.getIdentityCard(); results[i][4]=reader.getDate(); results[i][5]=reader.getMaxNum(); results[i][6]=reader.getTel(); results[i][7]=reader.getKeepMoney(); results[i][8]=array[reader.getZj()]; results[i][9]=reader.getZy(); results[i][10]=reader.getBook_id(); results[i][11]=reader.getBZtime(); } return results; } //圖書類別管理 //添加圖書信息 utton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { if(bookTypeName.getText().length()==0) { JOptionPane.showMMessageDialog(null,”圖書類別文本框不可為空“); return; } if(days.getText().length()==0) { JOptionPane.showMessageDialog(null,”可借天數(shù)文本框不可為空“); return; } if(!check.isNumeric(days.getText().trim())) { JOptionPane.showMessageDialog(null,”可借天數(shù)必須為數(shù)字“); return; } if(fakuan.getText().length()==0) { JOptionPane.showMessageDialog(null,”罰款文本框不可為空“); return; } if(!check.isNumeric(fakuan.getText().trim())) { JOptionPane.showMessageDialog(null,”罰款必須為數(shù)字“); return; } int i=Business.InsertBookType(bookTypeName.getText().trim(),days.getText().trim(),Double.valueof(fakuan.getText.trim())/10); if(i==1) { JOptionPane.showMessageDialog(null,”添加成功!“); doDefaultCloseAction(); } } }); panel_6.add(button); final JButton buttonDel=new JButton(); buttonDel.setText(”關(guān)閉“); buttonDel.addActionListener(new ActionListener(){ public void actionPerformed(final ActionEvent e){ doDefaultCloseAction(); } }); panel_6.add(buttonDel); setVisibel(true);} //修改圖書類 class ButtonAddListener implements ActionListener{ public void actionPerformed(ActionEvent e){ Object selectedItem=bookTypeModel.getSelectedItem(); int i=Business.UpdatebookType(BookTypeId.getText().trim(),selectedItem.toString(),days.getText().trim(),fk.getText().trim()); if(i==1) { JOptionPane.showMessageDialog(null,”修改成功"); object[][] results=getFileStates(Business.selectBookCategory()); model.setDataVector(results.columnNames); } } } table.setModel(model); 題目:用C/C++設(shè)計出模擬手機通信錄管理系統(tǒng),實現(xiàn)對手機中的通信錄進行管理。 (一)功能要求 (1)查看功能:選擇此功能時,列出下列三類選擇。 A 辦公類 B 個人類 C 商務(wù)類,當選中某類時,顯示出此類所有數(shù)據(jù)中的姓名和電話號碼) (2)增加功能:能錄入新數(shù)據(jù)(一個結(jié)點包括:姓名、電話號碼、分類(可選項有:A 辦公類 B 個人類 C 商務(wù)類)、電子郵件)。例如 楊春 *** 商務(wù)類 Chuny@126.C++om 當錄入了重復(fù)的姓名和電話號碼時,則提示數(shù)據(jù)錄入重復(fù)并取消錄入;當通信錄中超過15條信息時,存儲空間已滿,不能再錄入新數(shù)據(jù);錄入的新數(shù)據(jù)能按遞增的順序自動進行條目編號。 (3)拔號功能:能顯示通信錄中所有人姓名,當選中某個姓名時,屏幕上模擬打字機的效果依次顯示此人電話號碼中的各個數(shù)字,并伴隨相應(yīng)的拔號聲音。 (4)修改功能:選中某個人的姓名時,可對此人的相應(yīng)數(shù)據(jù)進行修改(5)刪除功能:選中某個人的姓名時,可對此人的相應(yīng)數(shù)據(jù)進行刪除,并自動調(diào)整后續(xù)條目的編號。 (二)其它要求: (1)只能使用C/C++語言,源程序要有適當?shù)淖⑨?,使程序容易閱讀(2)至少采用文本菜單界面(如果能采用圖形菜單界面更好)(3)建議使用結(jié)構(gòu)和鏈表等數(shù)據(jù)結(jié)構(gòu) (4)學(xué)生可自動增加新功能模塊(視情況可另外加分) 以下是源代碼,相應(yīng)的文檔為《通訊錄管理系統(tǒng)-數(shù)據(jù)結(jié)構(gòu)課程設(shè)計報告》,搜索即可 #include #define MAXSIZE 15 //聯(lián)系人信息 typedef struct { string name;//姓名 string teleNum;//電話號碼 int classes;//分類 string email;//電子郵件 }contacts; //鏈表存儲結(jié)構(gòu) typedef struct LNode { contacts data;//數(shù)據(jù)域 struct LNode* next;//指針域 }LNode,*LinkList; //初始化鏈表 int InitList(LinkList &L){ L = new LNode;L->next = NULL;return 0;} //前插法創(chuàng)建鏈表 void CreateList_H(LinkList &L,int n){ LinkList p; for(int i = 0;i < n;i++)//根據(jù)聯(lián)系人個數(shù)創(chuàng)建鏈表 { p = new LNode; cout <<“請輸入聯(lián)系人的姓名:”; cin >> p->data.name; cout <<“請輸入聯(lián)系人的電話號碼:”; cin >> p->data.teleNum; cout <<“請輸入聯(lián)系人的分類(分類如下,輸入相應(yīng)序號即可)”<< endl; cout <<“1 辦公類 個人類 商務(wù)類”<< endl; cin >> p->data.classes; cout <<“請輸入聯(lián)系人的電子郵件:”; cin >> p->data.email; p->next = L->next; L->next=p; } } //根據(jù)類別查看聯(lián)系人信息 void CheckAll(LinkList L,int c)//c是聯(lián)系人類別 { LinkList p;p = L->next; } cout <<“姓名tt”<<“電話號碼”<< endl;//表頭 while(p)//當鏈表沒到尾部時 { } if(p->data.classes==c)//若符合類別則輸出聯(lián)系人姓名和電話號碼 { cout << p->data.name <<“tt”<< p->data.teleNum << endl;} p=p->next;//重載函數(shù),查看所有聯(lián)系人 void CheckAll(LinkList L){ LinkList p; p=L->next; while(p) { cout << p->data.name << endl; p=p->next; } } //根據(jù)姓名查找聯(lián)系人 LinkList Search(LinkList L,string name){ LinkList p; p=L->next; while(p&&p->data.name!=name)//當鏈表沒到尾部且沒找到聯(lián)系人時 { p=p->next; } return p;} //判斷鏈表中是否存在聯(lián)系人c char IfExist(LinkList L,contacts c) { LinkList p; p=L->next; while(p&&p->data.name!=c.name)//根據(jù)姓名查找是否存在該聯(lián)系人 { p=p->next; } if(!p)//若到達鏈表尾部,則不存在return 'n'; if(p->data.teleNum==c.teleNum)//若找到聯(lián)系人姓名 if(p->data.classes==c.classes)//依次判斷電話號碼、類別、電子郵件是否相同 if(p->data.email==c.email) return 'y'; return 'n';} //獲取鏈表的長度 int Length(LinkList L){ int i=0; LinkList p=L->next; while(p) { ++i; p=p->next; } return i;} //增加聯(lián)系人 int Add(LinkList &L,contacts c){ LinkList p,s; if(Length(L)>=MAXSIZE)//判斷鏈表長度是否達到最大值 { cout <<“存儲空間已滿,無法新增聯(lián)系人!”<< endl; return 0;} if(IfExist(L,c)=='y')//判斷輸入的聯(lián)系人是否已經(jīng)存在{ cout <<“對不起,您輸入的聯(lián)系人已存在!”<< endl; return 0; } //若通訊錄中不存在該聯(lián)系人,則增加到通信錄 p=L;s=new LNode;s->data=c;s->next=p->next;p->next=s;return 0;} //撥號功能 void Dail(LinkList L,string name){ LinkList p,s; p=L->next; s=Search(L,name);//根據(jù)姓名查找聯(lián)系人所在//模擬打字機效果,輸出聯(lián)系人電話號碼 string tele=s->data.teleNum; for(int i=0;i { char c=tele[i];Sleep(500);cout << c;} cout << endl;//播放聲音 //PlaySound(“E:670.wav”,NULL,SND_FILENAME|SND_ASYNC);} //修改聯(lián)系人信息 void ChangeInfo(LinkList &L,string name){ LinkList p; p=Search(L,name);//找到聯(lián)系人的位置所在 cout <<“ 請輸入要修改的信息(輸入對應(yīng)序號即可):”<< endl; cout <<“1 姓名”<< endl; cout <<“2 電話號碼”<< endl; cout <<“3 分類”<< endl; cout <<“4 電子郵件”<< endl; //根據(jù)選擇修改聯(lián)系人信息 int elec; cin >> elec; switch(elec) { case 1: { cout <<“姓名改為:”<< endl; string newName; cin >> newName; p->data.name=newName; break;} case 2: { cout <<“電話號碼改為:”< string newTele; cin >> newTele; p->data.teleNum=newTele; break;} case 3: { cout <<“分類改為(分類如下,輸入相應(yīng)序號即可)”; cout <<“1 辦公類 個人類 商務(wù)類”<< endl; int newCalsses; cin >> newCalsses; p->data.classes=newCalsses; break;} case 4: { cout <<“電子郵件改為:”<< endl; string newEmail; cin >> newEmail; p->data.email=newEmail; break;} } } //刪除聯(lián)系人 void Delete(LinkList &L,string name){ LinkList p=L,s; //找到需刪除聯(lián)系人的前一個位置 while(p->next&&p->next->data.name!=name) { p=p->next; } s=p->next; p->next=s->next; delete s;//刪除聯(lián)系人 } //導(dǎo)入通信錄 void Read(LinkList L){ LinkList p; //打開文件導(dǎo)入通信錄 ifstream fin;fin.open(“通信錄.txt”,ios::in);string s1,s2,s3,s4;fin >> s1 >> s2 >> s3 >> s4;while(!fin.eof())//當沒有到文件尾時 { string s5;contacts c;fin >> c.name >> c.teleNum >> s5 >> c.email;if(s5.compare(“辦公類”)==0)c.classes=1; if(s5.compare(“個人類”)==0) c.classes=2; if(s5.compare(“商務(wù)類”)==0) c.classes=3; Add(L,c);//將聯(lián)系人c增加到鏈表中 } fin.close(); } //導(dǎo)出通信錄 void Write(LinkList L){ } LinkList p=L->next;int l=Length(L);//打開文件寫入通信錄 ofstream fout(“通信錄.txt”,ios::out|ios::trunc);fout <<“姓名t”<<“電話號碼t”<<“分類t”<<“電子郵件 ”<< endl;for(int i=0;i case 1: { fout <<“辦公類”; break; } case 2: { fout <<“個人類”; break; } case 3: { fout <<“商務(wù)類”; break; } } fout <<“t”<< p->data.email;if(i<(l-1)) fout << endl;p=p->next;} fout.close();int Menu()//主菜單 { system(“cls”);//清屏 int choice;cout< cout<<“ ***************主菜單***************n”;cout<<“ * 新增聯(lián)系人 *n”;cout<<“ * 查看通信錄 *n”; } cout<<“ * 撥號 *n”;cout<<“ * 修改信息 *n”;cout<<“ * 刪除聯(lián)系人 *n”;cout<<“ * 導(dǎo)入通信錄 *n”;cout<<“ * 導(dǎo)出通信錄 *n”;cout<<“ * 0 退出系統(tǒng) *n”;cout<<“ ************************************n”;cout<<“ 請根據(jù)您的需求,輸入相應(yīng)的數(shù)字:”;cin>>choice;//輸入選擇 return choice;int main()//主函數(shù) { LinkList L;InitList(L);for(;;){ switch(Menu())//根據(jù)不同選擇,執(zhí)行不同的功能 { case 1: { cout <<“請選擇批量增加或單個增加(輸入相應(yīng)序號即可):”<< endl;cout <<“1 批量增加 單個增加”<< endl;int c1;cin >> c1;if(c1==1){ cout <<“請輸入新增聯(lián)系人的個數(shù):”<< endl;int number;cin >> number;CreateList_H(L,number);//用前插法批量增加聯(lián)系人 } else //單個增加聯(lián)系人 { contacts c;cout <<“請輸入聯(lián)系人的姓名:”;cin >> c.name;cout <<“請輸入聯(lián)系人的電話號碼:”;cin >> c.teleNum;cout <<“請輸入聯(lián)系人的分類(分類如下,輸入相應(yīng)序號即可)”<< endl;cout <<“1 辦公類 個人類 商務(wù)類”<< endl;cin >> c.classes;cout <<“請輸入聯(lián)系人的電子郵件:”; cin >> c.email; Add(L,c); } system(“pause”);break; } case 2://查看通信錄 { cout <<“請輸入查看聯(lián)系人的類別(輸入相應(yīng)序號即可):”<< endl;cout <<“1 辦公類 個人類 商務(wù)類 ”<< endl;int c2;cin >> c2; cout <<“已有聯(lián)系人如下:”<< endl; CheckAll(L,c2);//根據(jù)分類查看聯(lián)系人信息 system(“pause”);break; } case 3: { cout <<“已有聯(lián)系人如下:”<< endl; CheckAll(L); string name;cout <<“請輸入撥號人的姓名:”<< endl;cin >> name; Dail(L,name);//根據(jù) system(“pause”);break; } case 4: { cout <<“已有聯(lián)系人如下:”<< endl;CheckAll(L);string changeName;cout <<“請輸入要修改信息的聯(lián)系人姓名:”<< endl;cin >> changeName;ChangeInfo(L,changeName); system(“pause”);break; } case 5: { cout <<“已有聯(lián)系人如下:”<< endl; CheckAll(L); string deleteName;cout <<“請輸入要刪除的聯(lián)系人姓名:”<< endl;cin >> deleteName; Delete(L,deleteName); cout <<“聯(lián)系人”<< deleteName <<“已刪除!”<< endl; system(“pause”);break; } case 6: { Read(L);//導(dǎo)入通信錄 cout <<“成功導(dǎo)入通信錄!”<< endl; cout <<“已導(dǎo)入聯(lián)系人姓名如下:”<< endl; CheckAll(L); system(“pause”); break; } case 7: { Write(L);//導(dǎo)出通信錄 cout <<“成功導(dǎo)出通信錄!”<< endl; system(“pause”); break; } case 0: { //退出系統(tǒng) cout<<“ 感謝您對本通信錄管理系統(tǒng)的使用!”< return 0;} default: 給予提示 } } } cout<<“ 您輸入的指令有誤,請重新輸入!”< 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 圖書管理系統(tǒng) 工程管理 121279044 伍楊 目錄一、二、三、題目要求...................................................................2 總體設(shè)計...................................................................2 編碼實現(xiàn)...................................................................3 1)定義圖書結(jié)構(gòu)體.......................................................3 2)登記操作...............................................................4 3)查看操作...............................................................8 4)刪除操作.............................................................11 5)Main函數(shù)...........................................................20四、五、六、調(diào)試與測試..............................................................26 五心得體會..............................................................28 用戶手冊.................................................................28 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 一、題目要求 1)目的要求 本課程設(shè)計任務(wù)的目的是要求學(xué)生按照分析、設(shè)計、編碼、調(diào)試和測試的軟件開發(fā)過程獨立完成管理系統(tǒng)設(shè)計,以及C語言算法的掌握,并能最終實現(xiàn)本系統(tǒng)的功能要求,通過這個程序可以學(xué)習(xí)到以前調(diào)試短程序沒有的的經(jīng)驗。2)題目要求 實現(xiàn)圖書管理信息系統(tǒng)的設(shè)計。要求實現(xiàn)圖書添加、顯示全部圖書、查詢、借閱和歸還。主要考查利用文件的操作! 二、總體設(shè)計 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 三、編碼實現(xiàn) 1)定義圖書結(jié)構(gòu)體 struct book{ char bookname[20]; //書名 int NO; //書編號 char type[20]; //類型 int date; //到書日期 };struct person{ char name[10]; //姓名 char classes[20]; //班級 int number; //學(xué)號 char telephone[12]; //聯(lián)系電話 int NO; //書編號 char bookname[20]; //書名 int borrowdate; //借書日期 int returndate; //還書日期 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 2)登記操作 void new_book(){ FILE *fp;struct book b;//登記新書 int i,j; printf(“請朱老師輸入此次收到的書本總數(shù):”);if((fp=fopen(“shuku.txt”,“a”))==NULL){ printf(“File open error!n”);exit(0);} scanf(“%d”,&i); for(j=0;j printf(“請朱老師輸入書名:”);scanf(“%s”,b.bookname);fprintf(fp,“%s”,b.bookname);printf(“請朱老師輸入書編號:”);scanf(“%d”,&b.NO);fprintf(fp,“ %d”,b.NO);printf(“請朱老師輸入類型:”);scanf(“%s”,b.type); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } } fprintf(fp,“ %s”,b.type);printf(“請朱老師輸入到書日期:”);scanf(“%d”,&b.date);fprintf(fp,“ %d”,b.date);if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0);void new_person() { FILE *fp;struct person p;char choice; //登記借書 if((fp=fopen(“jieshujilu.txt”,“a”))==NULL){ printf(“File open error!n”);exit(0);} 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“請朱老師輸入借書人姓名:”);scanf(“%s”,p.name);fprintf(fp,“%s”,p.name);printf(“請朱老師輸入借書人班級:”);scanf(“%s”,p.classes);fprintf(fp,“ %s”,p.classes);printf(“請朱老師輸入借書人學(xué)號:”);scanf(“%d”,&p.number);fprintf(fp,“ %d”,p.number);printf(“請朱老師輸入借書人聯(lián)系電話:”);scanf(“%s”,p.telephone);fprintf(fp,“ %s”,p.telephone);printf(“請朱老師輸入書編號:”);scanf(“%d”,&p.NO);fprintf(fp,“ %d”,p.NO);printf(“請朱老師輸入書名:”);scanf(“%s”,p.bookname);fprintf(fp,“ %s”,p.bookname);printf(“請朱老師輸入借書日期:”);scanf(“%d”,&p.borrowdate);fprintf(fp,“ %d”,p.borrowdate); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“請朱老師輸入還書日期:”);scanf(“%d”,&p.returndate);fprintf(fp,“ %d”,p.returndate);printf(“nt您想繼續(xù)嗎?(y/n)”);scanf(“ %c”,&choice);if(choice=='Y'||choice=='y'){ } system(“cls”);new_person();if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0);}實現(xiàn)程序?qū)ξ募淖x取 void Read(){ int i=0;int j=0;ifstream in(“Libra.txt”,ios::out);in>>i; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 nt; } all=i;if(i>0&&i<=Max){ in>>data[j].id>>data[j].name>>data[j].type>>data[j].status>>data[j].coufor(j=1;j<=i;j++){ } } in.close(); 3)查看操作 v void see_book(){ FILE *fp;long NO;char bookname[20];char type[20];long date;//查看書庫記錄 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } if((fp=fopen(“shuku.txt”,“r”))==NULL){ } printf(“File open error!n”);exit(0);while(!feof(fp)){ fscanf(fp,“%s%ld%s%ld”,bookname,&NO,type,&date);printf(“%-10s %-10ld %-10s %ldn”,bookname,NO,type,date);};if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0);void see_person(){ //查看所有借書記錄 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 FILE *fp;char name[10]; char classes[20]; int number;char telephone[20]; int NO; char bookname[20]; int borrowdate; int returndate; fscanf(fp,“%s %s %ld %s %ld %s %ld %ld”,name,classes,&number,telephonwhile(!feof(fp)){ if((fp=fopen(“jieshujilu.txt”,“r”))==NULL){ } printf(“File open error!n”);exit(0);e,&NO,bookname,&borrowdate,&returndate);printf(“%-5s %-5s %ld %-5s %ld %-5s %ld %ldn”,name,classes,number,telephone,NO,bookname,borrowdate,returndate); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } };if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0); 4)刪除操作 void delete_books() { int number;void deletebooks(); printf(“請輸入您要刪除的書編號:”);scanf(“%d”,&number);FILE *fp;struct book b; //刪除舊書 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 if((fp=fopen(“shuku.txt”,“r”))==NULL){ } printf(“不能打開此文件!n”);exit(0);while(!feof(fp)){ fscanf(fp,“%s %d %s %d”,b.bookname,&b.NO,b.type,&b.date); } if(b.NO==number){ } printf(“nnt***************圖書信息*******************n”);printf(“nt圖書書名:%25s”,b.bookname);printf(“nt----------”);printf(“nt圖書編號:%25d”,b.NO);printf(“nt----------”);printf(“nt圖書類型:%23s”,b.type);printf(“nt----------”);printf(“nt到書日期:%25d”,b.date);printf(“nt----------”); deletebooks(); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } void deletebooks(){ while(!feof(fp)){ fscanf(fp,“%s %d %s %d”,b.bookname,&b.NO,b.type,&b.date);if((fp=fopen(“shuku.txt”,“r”))==NULL){ } if((fp1=fopen(“tempshuku.txt”,“w”))==NULL){ //建立一個臨時文件 } printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0);printf(“nn確認刪除?請再次輸入書編號:”);scanf(“%d”,&number);FILE *fp,*fp1,*fp2,*fp3;int number;struct book b; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } if(b.NO==number)continue;else fprintf(fp1,“%s %d %s %d”,b.bookname,b.NO,b.type,b.date);fclose(fp);fclose(fp1);if((fp2=fopen(“tempshuku.txt”,“r”))==NULL){ } if((fp3=fopen(“shuku.txt”,“w”))==NULL){ //清空書庫 } while(!feof(fp2)){ //將臨時文件的內(nèi)容寫人源文件 } fscanf(fp2,“%s %d %s %d”,b.bookname,&b.NO,b.type,&b.date);fprintf(fp3,“%s %d %s %d”,b.bookname,b.NO,b.type,b.date);printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } void delete_returnbook(){ if((fp=fopen(“jieshujilu.txt”,“r”))==NULL){ } printf(“不能打開此文件!n”);exit(0);printf(“n請輸入所還書本的書編號:”);scanf(“%d”,&numbers);FILE *fp;int numbers;struct person p;void deletereturnbook();char choice;printf(“n 刪除成功!n”);fclose(fp2);fclose(fp3); //刪除借書記錄 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 while(!feof(fp)){ fscanf(fp,“%s %s %ld %s %ld %s %ld %ld”,p.name,p.classes,&p.number,p.telephone,&p.NO,p.bookname,&p.borrowdate,&p.returndate); if(p.NO==numbers){ printf(“nt***************圖書信息*******************n”);printf(“nt借書人姓名:%20s”,p.name);printf(“nt----------”);printf(“nt借書人班級:%20s”,p.classes);printf(“nt----------”);printf(“nt借書人學(xué)號:%20d”,p.number);printf(“nt----------”);printf(“nt借書人聯(lián)系電話:%20s”,p.telephone);printf(“nt----------”);printf(“nt圖書編號:%24d”,p.NO);printf(“nt----------”);printf(“nt圖書名稱:%23s”,p.bookname);printf(“nt----------”);printf(“nt借書日期:%25d”,p.borrowdate);printf(“nt----------”);printf(“nt還書日期:%25d”,p.returndate); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } } } printf(“nt----------”); deletereturnbook(); printf(“nt您想繼續(xù)嗎?(y/n)”);scanf(“ %c”,&choice);if(choice=='Y'||choice=='y'){ } system(“cls”);delete_returnbook();fclose(fp);void deletereturnbook(){ FILE *fp,*fp1,*fp2,*fp3;struct person p; int numbers;printf(“nn確認刪除?請再次輸入書編號:”); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 scanf(“%d”,&numbers);if((fp=fopen(“jieshujilu.txt”,“r”))==NULL){ } if((fp1=fopen(“tempbook.txt”,“w”))==NULL){ } printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0);while(!feof(fp)){ fscanf(fp,“%s %s %d %s %d %s %d %d”,p.name,p.classes,&p.number,p.telephone,&p.NO,p.bookname,&p.borrowdate,&p.returndate); if(p.NO==numbers)continue;else fprintf(fp1,“%s %s %d %s %d %s %d %d”,p.name,p.classes,p.number,p.telephone,p.NO,p.bookname,p.borrowdat 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 e,p.returndate); fscanf(fp2,“%s %s %d %s %d %s %d %d”,p.name,p.classes,while(!feof(fp2)){ //將臨時文件寫人源文件 if((fp2=fopen(“tempbook.txt”,“r”))==NULL){ } if((fp3=fopen(“jieshujilu.txt”,“w”))==NULL){ } printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0);fclose(fp);fclose(fp1);} &p.number,p.telephone,&p.NO,p.bookname,&p.borrowdate,&p.returndate); fprintf(fp3,“%s %s %d %s %d %s %d %d”,p.name,p.數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 classes,p.number,p.telephone,p.NO,p.bookname,p.borrowdate,p.returndate); } printf(“n 刪除成功!n”);fclose(fp2);fclose(fp3);} 5)Main函數(shù) int main(void){ do{ printf(“nnn 圖書館管理系統(tǒng)na”);printf(“ *******************************************************n”);int choice;char choice2;struct book;struct person; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“ ***朱老師您好吖********功能選項: 登記******請按1,******n”);printf(“ ******************************* 查看/查詢*請按2 ******n”);printf(“ ******************************* 刪除***** 請按3 ******n”);printf(“ ******************************* 退出***** 請按0 ******n”);printf(“ *******************************************************nnn”);printf(“ 請選擇功能:”);scanf(“%d”,&choice);switch(choice){ case 1: printf(“ 登記選項:新書登記請按1,借書登記請按2,返回請按3n”);printf(“請選擇:”);scanf(“%d”,&choice);switch(choice){ case 1: system(“cls”); //清屏 printf(“新書資料登記:nn”);new_book(); //新書登記 printf(“登記完畢!n”);printf(“n”);scanf(“ %c”,&choice2);system(“cls”);break; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 case 2: system(“cls”);printf(“借書資料登記:nn”);new_person(); //借書登記 printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 3: } break;system(“cls”);break; case 2: printf(“ 查看/查詢選項:書庫查看請按1,總借書記錄查看請按2,到期記錄查詢請按3,返回請按4n”); printf(“請選擇:”);scanf(“%d”,&choice);switch(choice){ case 1: system(“cls”);printf(“歡迎朱老師進入書庫!nn”); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“書名 書編號 類型 到書日期n”);printf(“-----------n”);see_book(); //書庫顯示 printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 2: system(“cls”);printf(“歡迎朱老師進入借書記錄!nn”);printf(“姓名 班級 學(xué)號 聯(lián)系電話 書編號 書名 借書日期 到書日期n”); printf(“-------------------------n”);see_person(); //借書記錄顯示 printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 3: system(“cls”);search_person(); //顯示符合記錄 printf(“n press anykey ”); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 scanf(“ %c”,&choice2);system(“cls”);break;case 4: } break;system(“cls”);break;case 3: printf(“ 刪除選項:舊書刪除請按1,借書記錄刪除請按2,返回請按3n”); printf(“請選擇:”);scanf(“%d”,&choice);switch(choice){ case 1: system(“cls”);delete_books(); //刪除ing printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 2: 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } system(“cls”);delete_returnbook(); //刪除ing printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 3: } break;system(“cls”);break;case 0: } system(“cls”);}while(choice!= 0);return 0; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 四、調(diào)試與測試 主菜單 登記 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 查看 刪除 生成的文件內(nèi)信息 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊五、五心得體會 經(jīng)過這次大作業(yè),我覺得代碼的編寫,最主要的的是編程思想,語言其實不是太重要,思路最重要! 六、用戶手冊 程序執(zhí)行文件為 lib sys.exe,打開執(zhí)行文件后按提示操作即可第四篇:通訊管理系統(tǒng)源代碼
第五篇:圖書管理系統(tǒng)(含源代碼)c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計報告