




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、中國地質(zhì)大學(xué)計(jì)算機(jī)高級語言課程設(shè)計(jì)報(bào)告(QT設(shè)計(jì)) 學(xué)生成績管理系統(tǒng)班級:191142班學(xué)號:姓名:日期:2015年7月2日一 課程設(shè)計(jì)題目與要求 (包括題目與系統(tǒng)功能要求)【實(shí)習(xí)內(nèi)容】C+語言,面向?qū)ο蟮姆治雠c設(shè)計(jì)。然后改成QT語言。【基本要求】學(xué)生成績管理是高等學(xué)校教務(wù)管理的重要組成部分,主要包括學(xué)生成績的錄入、刪除、查找及修改、成績的統(tǒng)計(jì)分析等等。請?jiān)O(shè)計(jì)一個(gè)系統(tǒng)實(shí)現(xiàn)對學(xué)生成績的管理。系統(tǒng)要求實(shí)現(xiàn)以下功能:(1)增加記錄:要求可以連續(xù)增加多條記錄。(2)刪除一個(gè)學(xué)生的記錄:要求可以先查找,再刪除。刪除前,要求用戶確認(rèn)。(3)成績修改:若輸入錯(cuò)誤可進(jìn)行修改;要求可以先查找,再修改。(4)查找
2、:可以根據(jù)姓名(或?qū)W號)查找某個(gè)學(xué)生的課程成績,查找某門課程成績處于指定分?jǐn)?shù)段內(nèi)的學(xué)生名單等等。(5)統(tǒng)計(jì)分析:對某個(gè)班級學(xué)生的單科成績進(jìn)行統(tǒng)計(jì),求出平均成績;求平均成績要求實(shí)現(xiàn)函數(shù)的重載,既能求單科的平均成績,又能求三科總分的平均成績。求出一門課程標(biāo)準(zhǔn)差和合格率;(6)排序功能:要求按總分進(jìn)行排序(從高到低),若總分相同,則按數(shù)學(xué)排序;若總分和數(shù)學(xué)相同,則按物理排序;若總分和各科成績都相同,則按學(xué)號排序;(7)文件操作:可以打開文件,顯示班級的所有學(xué)生信息;可以將增加或修改后的成績重新寫入文件;可以將排序好的信息寫入新的文件。【較高要求】查找可以實(shí)現(xiàn)模糊查詢,即輸入名字的一部分,可以列出滿足
3、條件的所有記錄。再從這個(gè)記錄中進(jìn)行二次選擇。二 需求分析【問題描述】在編寫過程中,主要的困難有:1. 模糊搜索(不能使用string中的find函數(shù))需要自定義一個(gè)函數(shù)。2. 排序,需要自己學(xué)習(xí)算法?!鞠到y(tǒng)環(huán)境】三 概要設(shè)計(jì)【類的設(shè)計(jì)】:類Student:#ifndef STUDENT_H#define STUDENT_H#include<iostream>#include<vector>#include<fstream>#include<string>#include<iomanip>#include<cmath>usi
4、ng namespace std;class studentprivate: string m_id, m_name; int m_math, m_eng, m_phy;public: student(); student(string, string, int, int, int); /構(gòu)造函數(shù) student(const student &); /復(fù)制構(gòu)造函數(shù) student(); / 析構(gòu)函數(shù) string getId(); /自定義接口 string getName(); intgetMath(); int getEng(); int getPhy(); int total()
5、; student operator=(const student &); / =號重載;#endif / STUDENT_H#define MANAGEMENT#include "student.h"#include"QString"#include<QFileDialog>#include<QFile>#include<qtextstream.h>class managementprivate: vector<student>stu;public: vector<student> d
6、eletetxt(const string& m); /刪除記錄 vector<student> findtxt(const string& m); /模糊搜索 vector<student> findtxt1(int,int,const string&); /分?jǐn)?shù)段搜索 vector<student> itxt(); /文件寫入 vector<student> getstu()return stu; vector<double> ttxt(vector<double>); /統(tǒng)計(jì)分析 vector
7、<student> ptxt(); /排序 void addtxt(); /增加記錄 void changetxt(); /成績修改 void otxt(); /文件輸出 void show(); /輸出;#endif / MANAGEMENT類mainwindow#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include"management.h"namespace Ui class MainWindow;class MainWindow : public QMain
8、Window Q_OBJECTpublic: explicit MainWindow(QWidget *parent = 0); MainWindow();private slots: void on_pushButton_clicked(); void on_ok_clicked(); void on_pushButton_2_clicked(); void on_ok_2_clicked(); void on_ss_clicked(); void on_ss_2_clicked(); void on_pushButton_3_clicked(); void on_pushButton_4_
9、clicked();private: Ui:MainWindow *ui;#endif / MAINWINDOW_H【主界面設(shè)計(jì)】:主機(jī)面主要以一個(gè)do-while循環(huán)使得系統(tǒng)能夠多次查詢。循環(huán)中大部分是判斷語句的嵌套。能夠以用戶意愿自由查詢和進(jìn)出系統(tǒng)。【文件讀到屏幕上】【修改記錄】【添加紀(jì)錄】【刪除記錄】【模糊搜索】【分段搜索】【統(tǒng)計(jì)分析】【排序】四 詳細(xì)設(shè)計(jì)"【增加記錄】:所用函數(shù):addtxt()函數(shù)、itxt()函數(shù)。增加記錄主要是調(diào)用void addtxt()函數(shù)。進(jìn)入void addtxt()函數(shù)后,用戶經(jīng)過手動(dòng)添加信息。添加信息過后,系統(tǒng)會(huì)將用戶所輸入的信息與數(shù)據(jù)庫中已
10、有信息進(jìn)行對比,判斷數(shù)據(jù)庫中是否已存在該信息。不存在則添加,添加時(shí)會(huì)調(diào)用student類的構(gòu)造函數(shù)。用戶所添加的信息則會(huì)有一個(gè)以類型為student的變量push_back到默認(rèn)以student為類型的容器中。然后點(diǎn)擊確定轉(zhuǎn)為槽函數(shù),再通過mainwindow類中的指針ui指向text edit,使結(jié)果輸出到text edit上。此時(shí)在經(jīng)過while循環(huán),使得系統(tǒng)支持重復(fù)添加功能。otxt()函數(shù)將數(shù)據(jù)輸出保存到date.txt文件中。【刪除記錄】:實(shí)現(xiàn)該功能先要調(diào)用void deletetxt()函數(shù)。進(jìn)入該函數(shù)后系統(tǒng)會(huì)提示用戶輸入所需刪除信息的學(xué)號或姓名。然后系統(tǒng)會(huì)在數(shù)據(jù)庫中搜索是否真的存
11、在此信息。不存在系統(tǒng)會(huì)提示用戶。若存在則所刪信息會(huì)在對話框中出現(xiàn)。此時(shí)系統(tǒng)會(huì)調(diào)用void deletetxt()函數(shù)、string getId()函數(shù)、string getName()函數(shù)、 intgetMath()函數(shù)int getEng()函數(shù)、int getPhy()函數(shù)、int total()函數(shù)。然后系統(tǒng)會(huì)提示用戶確定是否刪除該信息。若否則回到主菜單。若是此時(shí)系統(tǒng)會(huì)定義一個(gè)以student為類型的容器。然后默認(rèn)的以student為類型的容器(其中有數(shù)據(jù)庫中的全部信息。)經(jīng)過兩個(gè)for循環(huán)將數(shù)據(jù)庫中除了用戶要?jiǎng)h除的信息全部push_back到定義的容器中。然后再經(jīng)過一個(gè)for循環(huán)。使得
12、默認(rèn)的容器當(dāng)中的信息與定義的容器當(dāng)中的信息相同。則完成刪除。刪除成功后,通過mainwindow類中指針指向另一個(gè)對話框此時(shí)對話框會(huì)提示用戶刪除成功?!境煽冃薷摹浚合冗M(jìn)入void changetxt()函數(shù),對話框中會(huì)提示用戶輸入所要修改的信息。輸入信息后系統(tǒng)會(huì)定義一個(gè)以student為類型的變量。然后系統(tǒng)會(huì)調(diào)用student &operator=(const student &)函數(shù),使得修改后的信息覆蓋掉原有信息。在用mainwindow類中的指針ui把結(jié)果輸出到textedit上,在調(diào)用文本輸入的函數(shù)使得用戶能夠確定信息確實(shí)修改成功了?!静檎摇浚哼M(jìn)入查找后對話框中會(huì)提示用
13、戶是分?jǐn)?shù)段查找還是個(gè)人成績查詢。若是前者則系統(tǒng)調(diào)用void findtxt1()函數(shù)。此時(shí)對話框會(huì)提示用戶選擇哪一門成績以及分?jǐn)?shù)的上下限。然后系統(tǒng)再調(diào)用此時(shí)系統(tǒng)會(huì)調(diào)用void deletetxt()函數(shù)、string getId()函數(shù)、string getName()函數(shù)、 int getMath()函數(shù)int getEng()函數(shù)、int getPhy()函數(shù)、int total()函數(shù)。對話框中會(huì)出現(xiàn)在此分?jǐn)?shù)段中的所有信息。并回到菜單。若是后者則系統(tǒng)調(diào)用void findtxt()函數(shù)(支持模糊搜索)。此時(shí)對話框中會(huì)提示用戶輸入所要尋找的信息的學(xué)號或姓名。系統(tǒng)會(huì)將數(shù)據(jù)庫中滿足條件的信息反
14、饋到對話框中,然后mainwindow類中指針ui將返回的容器的成員轉(zhuǎn)化為QString類型然后將結(jié)果反饋到text edit上。【統(tǒng)計(jì)分析】:現(xiàn)根據(jù)對話框的提示選擇系統(tǒng)分析欄。對話框會(huì)提示用戶是單科情況或是全科情況。若是前者系統(tǒng)會(huì)調(diào)用void ttxt()函數(shù),把結(jié)果反饋到對話框中并回到主菜單中。若是后者系統(tǒng)調(diào)用void ttxt(int i)函數(shù)。然后把結(jié)果(平均分、總平局分、及格率、標(biāo)準(zhǔn)差)用mainwindow類中指針ui轉(zhuǎn)到另一個(gè)對話框中,在調(diào)用該對話框中的指針ui將結(jié)果反饋到text edit上?!九判颉浚含F(xiàn)根據(jù)對話框的提示選擇排序。系統(tǒng)會(huì)調(diào)用void ptxt()函數(shù)。進(jìn)入voi
15、d ptxt()函數(shù)系統(tǒng)會(huì)調(diào)用string getId()函數(shù)、string getName()函數(shù)、 intgetMath()函數(shù)int getEng()函數(shù)、int getPhy()函數(shù)、int total()函數(shù)。根據(jù)總分進(jìn)行排序(從高到低),若總分相同,則按數(shù)學(xué)排序;若總分和數(shù)學(xué)相同,則按物理排序;若總分和各科成績都相同,則按學(xué)號排序;排序完成后,mainwindow類中指針ui將容器中的信息全部轉(zhuǎn)化為QString類型。然后調(diào)用輸出文本將結(jié)果反饋到text edit上。【退出系統(tǒng)】:在主菜單中選擇退出系統(tǒng),系統(tǒng)會(huì)跳出主菜單中的do-while循環(huán),結(jié)束程序。五 測試【原有數(shù)據(jù)】201
16、21000290 邊達(dá)宇 75 60 65 20121000424 王晨 85 95 9620121000553 高佳維 86 93 9020121000570 初國利 85 87 8520121000584 利振彬 70 88 8820121000818 孟珂 90 86 96 20121000921 羅云迪 86 90 7520121001121 田甜 95 85 8720121001248 王如男 90 89 9420121001316 邵葉飛 80 84 8620121001375 周晨曦 87 86 9020121001695 王洪 96 88 9120121001842 尹笛露 8
17、5 90 9420121002002 劉宇坤 88 86 9020121002152 尹然宇 82 90 8820121002162 孫史磊 80 94 8020121002269 陳云鍋 83 95 8520121002321 于文濤 88 90 8620121002439 景揭俊 85 92 8520121002585 戴賢鐸 88 86 7820121002685 曹厚臻 90 87 9020121002775 馬晴 93 85 9020121003127 馮澤宇 80 89 7520121003358 肖寒 88 90 9020121003359 張賡 87 95 8420121003
18、398 劉劍峰 88 84 8620121003399 龔方怡 90 93 9620121004233 賈國棟 88 90 8620121004415 孫一卓 86 95 90六 結(jié)論【總結(jié)】:1. 在設(shè)計(jì)程序時(shí),我們需要對每個(gè)文件域之間的聯(lián)系了解,包含關(guān)系要明確。每設(shè)計(jì)完成一個(gè)函數(shù)時(shí)我們都要進(jìn)行測試。確保沒有語法錯(cuò)誤和邏輯錯(cuò)誤后再進(jìn)行下一個(gè)函數(shù)的設(shè)計(jì)。將函數(shù)編寫完之后,再進(jìn)行mian函數(shù)的編寫。2. 在設(shè)計(jì)文件讀入與文件輸出時(shí),要保證保存路徑的正確性。通過此次課設(shè)使得我對這兩個(gè)知識點(diǎn)更好的理解與掌握。3. 對于引用、運(yùn)算符的重載的運(yùn)用更加透徹。意識到在設(shè)計(jì)當(dāng)中應(yīng)盡量提高系統(tǒng)的效率的重要性。4
19、. 在設(shè)計(jì)模糊搜索和刪除記錄中,使得我對類string中自帶的find函數(shù)與erase函數(shù)的執(zhí)行過程的理解。5. 此次課設(shè)使我明白了在設(shè)計(jì)時(shí)應(yīng)以謹(jǐn)慎的態(tài)度對待。不能馬虎粗心。不要太過心急。遇到困難要冷靜。6. 在做QT可視化時(shí),遇到了許多問題。由于對很多系統(tǒng)自帶的函數(shù)斌不了解,所以花了很多時(shí)間去網(wǎng)上查閱了很多知識點(diǎn)。也學(xué)到了很多東西。7. 在做彈出對話框時(shí),用了很多工夫去做這個(gè),但依舊有一些我目前無法解決的問題。8. 為了界面跟家美觀,向同學(xué)請教了如何做背景。然后自己也將畫面中的字體和顏色改變,但依舊還是有一些不足之處。例如:當(dāng)信息輸出到text edit上,若滑動(dòng)鼠標(biāo)上的滑輪時(shí),背景會(huì)出現(xiàn)斷
20、層現(xiàn)象。七 附錄#ifndef DIALOG_CHAGE_H#define DIALOG_CHAGE_H#include <QDialog>namespace Ui class Dialog_chage;class Dialog_chage : public QDialog Q_OBJECTpublic: explicit Dialog_chage(QWidget *parent = 0); Dialog_chage();private slots: void on_pushButton_clicked();private: Ui:Dialog_chage *ui;#endif /
21、 DIALOG_CHAGE_H#ifndef DIALOG_DELETE_H#define DIALOG_DELETE_H#include <QDialog>namespace Ui class Dialog_delete;class Dialog_delete : public QDialog Q_OBJECTpublic: explicit Dialog_delete(QWidget *parent = 0); Dialog_delete();private: Ui:Dialog_delete *ui;#endif / DIALOG_DELETE_H#ifndef DIALOG
22、_TONGJI_H#define DIALOG_TONGJI_H#include <QDialog>namespace Ui class Dialog_tongji;class Dialog_tongji : public QDialog Q_OBJECTpublic: explicit Dialog_tongji(QWidget *parent = 0); Dialog_tongji();private slots: void on_pushButton_clicked();private: Ui:Dialog_tongji *ui;#endif / DIALOG_TONGJI_
23、H#ifndef MAINWINDOW_H#define MAINWINDOW_H#include <QMainWindow>#include"management.h"namespace Ui class MainWindow;class MainWindow : public QMainWindow Q_OBJECTpublic: explicit MainWindow(QWidget *parent = 0); MainWindow();private slots: void on_pushButton_clicked(); void on_ok_clic
24、ked(); void on_pushButton_2_clicked(); void on_ok_2_clicked(); void on_ss_clicked(); void on_ss_2_clicked(); void on_pushButton_3_clicked(); void on_pushButton_4_clicked();private: Ui:MainWindow *ui;#endif / MAINWINDOW_H#ifndef MANAGEMENT#define MANAGEMENT#include "student.h"#include"
25、QString"#include<QFileDialog>#include<QFile>#include<qtextstream.h>class managementprivate: vector<student>stu;public: vector<student> deletetxt(const string& m); /刪除記錄 vector<student> findtxt(const string& m); /模糊搜索 vector<student> findtxt1(int
26、,int,const string&); /分?jǐn)?shù)段搜索 vector<student> itxt(); /文件寫入 vector<student> getstu()return stu; vector<double> ttxt(vector<double>); /統(tǒng)計(jì)分析 vector<student> ptxt(); /排序 void addtxt(); /增加記錄 void changetxt(); /成績修改 void otxt(); /文件輸出 void show(); /輸出;#endif / MANAGEMENT#
27、ifndef STUDENT_H#define STUDENT_H#include<iostream>#include<vector>#include<fstream>#include<string>#include<iomanip>#include<cmath>using namespace std;class studentprivate: string m_id, m_name; int m_math, m_eng, m_phy;public: student(); student(string, string, i
28、nt, int, int); /構(gòu)造函數(shù) student(const student &); /復(fù)制構(gòu)造函數(shù) student(); / 析構(gòu)函數(shù) string getId(); /自定義接口 string getName(); intgetMath(); int getEng(); int getPhy(); int total(); student operator=(const student &); / =號重載;#endif / STUDENT_H#include "dialog_chage.h"#include "ui_dialog_ch
29、age.h"#include"management.h"#include<QString>#include<QGraphicsOpacityEffect>Dialog_chage:Dialog_chage(QWidget *parent) : QDialog(parent), ui(new Ui:Dialog_chage) ui->setupUi(this); QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this); effect->setOpacity
30、(0.4); ui->textEdit->setGraphicsEffect(effect);Dialog_chage:Dialog_chage() delete ui;void Dialog_chage:on_pushButton_clicked() management me; vector<student>v=me.itxt(); string str; student stu; QString Q; Q=ui->lineEdit->text(); str=Q.toStdString(); int i,j,k; int p(0); for(i=0;i&
31、lt;v.size();i+) stu=vi; for(j=0;j<str.size();j+) if(strj!=stu.getId()j) break; if(j=str.size() p+; break; for(k=0;k<str.size();k+) if(strk!=stu.getName()k) break; if(k=str.size() p+; break; if(p=0) ui->textEdit->insertPlainText("沒有您所修改學(xué)生的信息!"); else student temp(stu.getId(),stu
32、.getName(),ui->lineEdit_2->text().toInt(), ui->lineEdit_3->text().toInt(),ui->lineEdit_4->text().toInt(); vi=temp; ui->textEdit->insertPlainText("修改成功!"); me.otxt();#include "dialog_delete.h"#include "ui_dialog_delete.h"Dialog_delete:Dialog_delet
33、e(QWidget *parent) : QDialog(parent), ui(new Ui:Dialog_delete) ui->setupUi(this);Dialog_delete:Dialog_delete() delete ui;#include "dialog_#h"#include "ui_dialog_#h"#include"management.h"#include"student.h"#include<vector>#include<QGraph
34、icsOpacityEffect>Dialog_tongji:Dialog_tongji(QWidget *parent) : QDialog(parent), ui(new Ui:Dialog_tongji) ui->setupUi(this); ui->textEdit->insertPlainText("確定顯示統(tǒng)計(jì)分析?"); QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this); effect->setOpacity(0.6); ui->textEdi
35、t->setGraphicsEffect(effect);Dialog_tongji:Dialog_tongji() delete ui;void Dialog_tongji:on_pushButton_clicked() QString qst; ui->textEdit->clear(); management me; ui->textEdit->insertPlainText("科目依次為數(shù)學(xué)、英語、物理。"); ui->textEdit->insertPlainText("前三個(gè)為平均分,中間為及格率,后三個(gè)為標(biāo)準(zhǔn)
36、差"); vector<double>in; in=me.ttxt(in); for(int i=0;i<in.size();i+) qst=QString:number(ini); ui->textEdit->insertPlainText(qst+'n'); #include "mainwindow.h"#include <QApplication>int main(int argc, char *argv) QApplication a(argc, argv); MainWindow w; w.sho
37、w(); return a.exec();#include "mainwindow.h"#include "ui_mainwindow.h"#include"management.h"#include "dialog_chage.h"#include "dialog_delete.h"#include "dialog_#h"#include<QString>#include"student.h"#include<QGraphi
38、csOpacityEffect>#include <QDialog>management me;vector<student>v=me.itxt();QString s2q(const string &s) return QString(QString:fromLocal8Bit(s.c_str(); MainWindow:MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui:MainWindow) ui->setupUi(this); ui->textEdit->set
39、Text(" 歡迎進(jìn)入學(xué)生成績管理系統(tǒng)!"); QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect(this); effect->setOpacity(0.5); ui->label_7->setGraphicsEffect(effect); ui->textEdit->setGraphicsEffect(effect);MainWindow:MainWindow() delete ui;void MainWindow:on_pushButton_clicked() ui-&g
40、t;textEdit->clear(); ui->textEdit->insertPlainText("ID: 姓名:數(shù)學(xué):英語: 物理:"); QString a,b,c,d,e,o; student s; for(int i=0;i<v.size();i+) s=vi; a=s2q(s.getId(); b=s2q(s.getName(); c=QString:number(s.getMath(),10); d=QString:number(s.getEng(),10); e=QString:number(s.getPhy(),10); o=a+
41、' '+b+' '+c+' '+d+' '+e+'n' ui->textEdit->insertPlainText(o); void MainWindow:on_ok_clicked() ui->textEdit->clear(); student temp(ui->ID->text().toStdString(),ui->xingming->text().toStdString(),ui->shuxue->text().toInt(), ui->y
42、ingyu->text().toInt(),ui->wuli->text().toInt(); v.push_back(temp); QString a,b,c,d,e,o; a=s2q(temp.getId(); b=s2q(temp.getName(); c=QString:number(temp.getMath(),10); d=QString:number(temp.getEng(),10); e=QString:number(temp.getPhy(),10); o=a+' '+b+' '+c+' '+d+'
43、'+e+'n' ui->textEdit->insertPlainText(o); ui->textEdit->insertPlainText("添加成功!"); me.otxt();void MainWindow:on_pushButton_2_clicked() Dialog_chage * dialog1 = new Dialog_chage(this); dialog1->setWindowTitle(tr("change information"); if(dialog1->exec(
44、)=QDialog:Rejected) return;void MainWindow:on_ok_2_clicked() QString qst=ui->delete_2->text(); string st=qst.toStdString(); v=me.deletetxt(st); ui->delete_2->clear(); Dialog_delete * dialog2 = new Dialog_delete(this); dialog2->setWindowTitle(tr("delete information"); if(dial
45、og2->exec()=QDialog:Rejected) return;void MainWindow:on_ss_clicked() QString qst=ui->sousuo->text(); string str=qst.toStdString(); v=me.findtxt(str); on_pushButton_clicked(); ui->sousuo->clear();void MainWindow:on_ss_2_clicked() QString qst1=ui->kemu->text(); QString qst2=ui->
46、;sousuo1->text(); QString qst3=ui->sousuo2->text(); string str=qst1.toStdString(); int a=qst2.toInt(); int b=qst3.toInt(); v=me.findtxt1(a,b,str); if(v.size() on_pushButton_clicked(); else ui->textEdit->clear(); ui->textEdit->insertPlainText("對不起!沒有您所查的信息!"); ui->ke
47、mu->clear(); ui->sousuo1->clear(); ui->sousuo2->clear();void MainWindow:on_pushButton_3_clicked() Dialog_tongji * dialog3 = new Dialog_tongji(this); dialog3->setWindowTitle(tr("tongji information"); if(dialog3->exec()=QDialog:Rejected) return;void MainWindow:on_pushBut
48、ton_4_clicked() v=me.ptxt(); on_pushButton_clicked();#include"management.h"#include<cmath>void management:addtxt() /增加記錄 string id, name; int math, eng, phy,m; int p(0); while(1) cout << "請輸入您所添加的信息:" << endl; cin >> id >> name >> math >>
49、 eng >> phy; student s(id, name, math, eng, phy); for(int i=0;i<stu.size();i+) if(s.getId()=stui.getId()&&(s.getName()=stui.getName() cout<<"數(shù)據(jù)庫已有此人!不能再添加!"<<endl; p+; if(p=0) stu.push_back(s); otxt(); cout<<"是否繼續(xù)增加? (繼續(xù)回復(fù)1。否則回復(fù)0.)"<<endl;
50、 cin>>m; if(m=0) break; vector<student> management:itxt() /文件寫入 ifstream ifile; ifile.open("F:data.txt"); string id, name; int math, eng, phy; do ifile>>id>>name>>math>>eng>>phy; student s(id, name, math, eng, phy); stu.push_back(s); while (!ifile.
51、eof(); ifile.close(); return stu;void management:otxt() /文件輸出 ofstream ofile; ofile.open("F:date.txt"); for (int i=0; i<stu.size();i+) ofile<<setw(20)<<stui.getId()<<setw(6)<<stui.getName()<<setw(6)<<stui.getMath()<<setw(6)<<stui.getEng()&
52、lt;<setw(6)<<stui.getPhy()<<endl; ofile.close();vector<student> management:findtxt(const string& m) /模糊搜索 vector<student>s; int p(0),q(0); int i,j,k; for(i=0;i<stu.size();i+) for(j=0;j<m.size();j+) if(mj!=stui.getId()j) break; if(j=m.size() s.push_back(stui); for(k=0;k<m.size();k+) if(mk!=stui.getName()k) break; if(k=m.size() s.push_back(stui); return s;vector<student> management:findtxt1(int a,int b
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 建筑施工特種作業(yè)-建筑起重機(jī)械司機(jī)(物料提升機(jī))真題庫-3
- 建筑施工特種作業(yè)-建筑起重機(jī)械安裝拆卸工(塔式起重機(jī))真題庫-2
- 2023-2024學(xué)年陜西省寶雞市渭濱區(qū)高二下學(xué)期期末質(zhì)量監(jiān)測數(shù)學(xué)試卷(解析版)
- 膠水嫁接方法解大全
- 質(zhì)檢員崗位說明書
- 佛山條碼庫存管理制度
- 作業(yè)工具使用管理制度
- 作業(yè)配合人員管理制度
- 使用機(jī)械安全管理制度
- 供水檢修班組管理制度
- 2024年河南省中考數(shù)學(xué)試卷真題及答案詳解(精校打?。?/a>
- 2024年河北省中考數(shù)學(xué)真題試卷及答案
- 2024屆新疆維吾爾阿克蘇地區(qū)小升初語文檢測卷含答案
- MOOC 工科數(shù)學(xué)分析(一)-北京航空航天大學(xué) 中國大學(xué)慕課答案
- 汽車零部件生產(chǎn)過程大數(shù)據(jù)分析與管理
- 部編版《道德與法治》五年級下冊第11課《屹立在世界的東方》教學(xué)設(shè)計(jì)
- 2023年新疆維吾爾自治區(qū)石河子市小升初數(shù)學(xué)試卷(內(nèi)含答案解析)
- 初中地理七下8.3.2《撒哈拉以南非洲》教學(xué)設(shè)計(jì)
- 鋁錠應(yīng)用行業(yè)分析
- 湖北煙草公司招聘考試真題
- 心衰的中西醫(yī)結(jié)合治療
評論
0/150
提交評論