網站首頁 編程語言 正文
本文實例為大家分享了C++實現簡單信息管理系統的具體代碼,供大家參考,具體內容如下
信息管理系統
因為學校布置了寫一個信息管理系統的作業,所以寫下了這個信息管理系統,這是用cpp寫的一個簡單程序。
基本思路是通過控制臺程序,然后通過數字命令來進行操作。
該程序編譯了多文件;
因為是學校的作業所以我把萬能頭換成了
#include"stdc++.h"
功能和萬能頭一致。
該系統使用了鏈表來鏈接各個數據。
程序的基本功能是打算寫兩個系統,輸入1和賬號密碼進入學生管理系統
輸入2和賬號密碼進入教師管理系統
但是我只寫了教師管理系統,因為這是學校的作業,而且之前我有寫過學生管理系統了,所以沒打算再寫一次,以后有時間再說。
進入教師管理系統以后 :
輸入1:用戶自己增加教師信息
輸入2:用戶可以通過教師工號更改教師的姓名或身份證號或年齡或教師工號或者工資或者執教課程或課程學分。
輸入3:通過教師工號來刪除特定教師
輸入4:顯示所有的教師信息
輸入5:從指定文件(D:\1808190126許達峰\Data.txt)讀入信息。
輸入6:顯示符合某個特定信息的教師,可以用教師姓名、身份證、工號、工資、年齡、執教課程進行檢索
輸入7:可以通過教師工號、工資、年齡進行排序(從小到大)
輸入0:退出系統。
主程序代碼如下:
#include"stdc++.h" #include"interface.h" #include"actions.h" #include"teacherMessage.h" #includeusing namespace std; int main(){ ?? ?system("color 0F"); ?? ?//信息管理系統選項 ?? ?tasks(); ?? ?return 0; }
這里包括了萬能頭、界面樣式、用戶操作、教師類定義四個頭文件。
萬能頭文件如下:
#ifndef _GLIBCXX_NO_ASSERT #include#endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if __cplusplus >= 201103L #include #include #include #include #include #include #include #include #include #endif // C++ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include
#include
界面樣式代碼如下:
.h文件代碼:
#ifndef INTERFACE #define INTERFACE #include"stdc++.h" using namespace std; //教師信息管理系統界面樣式 void MainFace(); //信息管理系統界面樣式 void outFace(); #endif INTERFACE
.cpp文件代碼:
#include"interface.h" //教師信息管理系統界面樣式 void MainFace(){ ? ? cout<<" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?"<<"---------------------------------------------------------------"<
用戶操作代碼如下:
.h文件
#ifndef ACTIONS #define ACTIONS #include"stdc++.h" #include"teacherMessage.h" using namespace std; typedef struct teacherDate * List; typedef struct teacherDate Data; //鏈表的構成元素 struct teacherDate { ? ? Teacher self; ? ? List next; }; //教師信息管理系統選項 void acts(); //主界面選項 void tasks(); #endif
.cpp文件
#include"actions.h" #include"interface.h" #include"teacherSystem.h" #include//賬號密碼 const string R_Id="teacher"; const string R_password="123456789"; //主界面選項 void tasks(){ ? ? int task; ? ? outFace(); ? ? cout<<"請輸入0-2:";? ? ? while(cin>>task){ ? ? ? ? if(task==0){ ?? ??? ??? ?cout<<"拜拜"< >Id>>passwrod; ?? ??? ??? ?//檢驗賬號密碼是否正確 ? ? ? ? ? ? if(Id==R_Id){ ?? ??? ??? ??? ?if(passwrod==R_password){ ? ? ? ? ? ? ? ? acts(); ?? ??? ??? ??? ?}else{ ?? ??? ??? ??? ??? ?cout<<"密碼錯誤"< >a){ ? ? ? ? if(a==1){ ?? ??? ??? ?//增加教師信息 ?? ??? ??? ?head=add(head); ? ? ? ? }else if(a==2){ ?? ??? ??? ?//更改教師信息 ?? ??? ??? ?head=changeActs(head); ? ? ? ? }else if(a==3){ ?? ??? ??? ?//刪除教師信息 ?? ??? ??? ?head=excludeActs(head); ? ? ? ? }else if(a==4){ ?? ??? ??? ?//顯示所有教師信息 ?? ??? ??? ?head=dataFace(head); ? ? ? ? }else if(a==5){ ?? ??? ??? ?//從文件錄入教師信息 ?? ??? ??? ?head=readin(head); ? ? ? ? }else if(a==6){ ?? ??? ??? ?//顯示教師信息 ?? ??? ??? ?head=showTeacherActs(head); ? ? ? ? }else if(a==7){ ?? ??? ??? ?//對教師信息進行排序 ? ? ? ? ? ? head=softData(head); ? ? ? ? }else if(a==0){ ?? ??? ??? ?cout<<"將返回主界面"<
用戶操作定義還包括下屬的數字命令文件
數字命令文件代碼如下:
.h文件
#ifndef TEACHERSYSTEM #define TEACHERSYSTEM #include"stdc++.h" #include"actions.h" using namespace std; //增加教師信息 List add(List head); //更改教師信息 List changeActs(List head); //刪除教師信息 List excludeActs(List head); //顯示所有教師信息 List dataFace(List head); //從文件錄入教師信息 List readin(List head); //顯示教師信息 List showTeacherActs(List head); //對教師信息進行排序 List softData(List head); //清除所有數據,防止內存泄露 List clearAll(List head); //根據教師工號搜索指定教師 List findTeacher(List head,string teacherId); #endif TEACHERSYSTEM
.cpp文件
#include"teacherSystem.h" #include"interface.h" #include"teacherMessage.h" #include"changeActions.h" //增加教師信息 List add(List head){ ? ? string Name,Age,teacherId,salary; ?? ?string Identify; ?? ?string LesName,Point; ?? ?Lesson course; ? ? if(head==NULL){? ? ? ? ? //為首結點動態分配空間 ? ? ? ? head=new Data; ? ? ? ? ? ? ? ? ? ? ? ? ? ? cout<<"請依次輸入教師的姓名、身份證號(后四位)、年齡、教師工號、工資、執教課程、課程學分:"; ? ? ? ? cin>>Name>>Identify>>Age>>teacherId>>salary>>LesName>>Point; ? ? ? ? //將數據傳入Teacher類中 ?? ??? ?course.getData(LesName,Point); ? ? ? ? head->self.getData(Name,Identify,Age,teacherId,salary,course); ? ? ? ? //令下一個結點為空 ? ? ? ? ? ? ? ? ? ? head->next=NULL; ? ? }else{ ? ? ? ? List current,record; ? ? ? ? current=head; ? ? ? ? //通過遍歷找到空結點,把數據分配到空結點中 ? ? ? ? while(current->next){ ? ? ? ? ? ? current=current->next; ?? ??? ??? ?record=current->next; ? ? ? ? } ?? ??? ?if(current==head) ?? ??? ??? ?record=current->next; ? ? ? ? cout<<"請依次輸入教師的姓名、身份證號(后四位)、年齡、教師工號、工資、執教課程、課程學分:"; ? ? ? ? cin>>Name>>Identify>>Age>>teacherId>>salary>>LesName>>Point; ?? ??? ?course.getData(LesName,Point); ? ? ? ? //為新結點動態分配空間 ? ? ? ? record= new Data; ? ? ? ? record->self.getData(Name,Identify,Age,teacherId,salary,course); ?? ??? ?//令下一個結點為空 ?? ??? ?record->next=NULL; ?? ??? ?current->next=record; ? ? } ?? ?return head; } //更改教師信息 List changeActs(List head){ ? ? int choose; ? ? string teacherId; ? ? cout<<"---------------------------------------------------"<>choose; ?? ?cout< >teacherId; ? ? if(choose==1){ ? ? ? ? changeName(head,teacherId); ? ? }else if(choose==2){ ? ? ? ? changeIdentify(head,teacherId); ? ? }else if(choose==3){ ? ? ? ? changeAge(head,teacherId); ? ? }else if(choose==4){ ? ? ? ? changeTeacherId(head,teacherId); ? ? }else if(choose==5){ ? ? ? ? changeSalary(head,teacherId); ? ? }else if(choose==6){ ?? ??? ?changeLesName(head,teacherId); ?? ?}else if(choose==7){ ?? ??? ?changePoint(head,teacherId); ?? ?}else{ ? ? ? ? cout<<"無效輸入"< self.showmessage(); ?? ??? ??? ?cout< next; ?? ??? ?} ?? ?} ? ? return head; } //刪除教師信息 List excludeActs(List head){ ? ? string teacherId; ? ? cout<<"請輸入你要刪除的教師的教師工號:"; ? ? cin>>teacherId; ? ? List current=head,before; ? ?? ? ? if(current){ ?? ??? ?while(current->next!=NULL&¤t->self.getTeacherId()!=teacherId){ ?? ??? ??? ?before=current; ?? ??? ??? ?current=current->next; ?? ??? ?} ? ? ? ? if(current->self.getTeacherId()==teacherId){ ? ? ? ? ? ? if(current==head){ ? ? ? ? ? ? ? ? List record=head; ? ? ? ? ? ? ? ? head=head->next; ? ? ? ? ? ? ? ? delete record; ? ? ? ? ? ? ? ? return head; ? ? ? ? ? ? }else{ ? ? ? ? ? ? ? ? before->next=current->next; ? ? ? ? ? ? ? ? delete current; ? ? ? ? ? ? } ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在!"< >choose; ? ? if(choose==1){ ? ? ? ? searchName(head); ? ? }else if(choose==2){ ? ? ? ? searchIdentify(head); ? ? }else if(choose==3){ ? ? ? ? searchTeacherId(head); ? ? }else if(choose==4){ ? ? ? ? searchSalary(head); ? ? }else if(choose==5){ ?? ??? ?searchAge(head); ?? ?}else if(choose==6){ ?? ??? ?searchCourseLesName(head); ?? ?}else{ ? ? ? ? cout<<"無效操作"< next){ ?? ??? ??? ?current=current->next; ?? ??? ??? ?recall=current->next; ?? ??? ?} ?? ??? ?if(current==head) ?? ??? ??? ?recall=current->next; ?? ?} ?? ?if(!fin.is_open()){ ?? ??? ?cout<<"打開文件失敗!"< >Name>>Identify>>Age>>teacherId>>salary>>LesName>>Point){ ?? ??? ??? ?recall=new Data;?? ??? ??? ? ?? ??? ??? ?if(head==NULL){ ?? ??? ??? ??? ?head=recall; ?? ??? ??? ?}else{ ?? ??? ??? ??? ?current->next=recall; ?? ??? ??? ?} ?? ??? ??? ?course.getData(LesName,Point); ?? ??? ??? ?recall->self.getData(Name,Identify,Age,teacherId,salary,course); ?? ??? ??? ?recall->next=NULL; ?? ??? ??? ?current=recall; ?? ??? ?} ?? ??? ?fin.clear(); ?? ?} ? ? return head; } //對教師信息進行排序 List softData(List head){ ?? ?int choose; ? ? cout<<"-----------------------------------------"< >choose; ? ? if(choose==1){ ? ? ? ? head=bubbleSofAge(head); ? ? }else if(choose==2){ ? ? ? ? head=bubbleSoftTeacherId(head); ? ? }else if(choose==3){ ? ? ? ? head=bubbleSoftSalary(head); ? ? }else{ ? ? ? ? cout<<"a無效操作!"< next!=NULL&¤t->self.getTeacherId()!=teacherId){ ? ? ? ? current=current->next; ? ? } ? ? return current; } //清除所有數據,防止內存泄露 List clearAll(List head){ ? ? List current=head,record; ?? ?if(head!=NULL){ ? ? ? ? while(current){ ? ? ? ? ? ? record=current->next; ? ? ? ? ? ? delete current; ? ? ? ? ? ? current=record; ? ? ? ? } ?? ?} ? ? return head=NULL; }
教師系統操作還包括以下文件:
.h文件:
#ifndef CHANGEACTIONS #define CHANGEACTIONS #include"stdc++.h" #include"actions.h" using namespace std; //更改姓名 void changeName(List head,string teacherId); //更改身份證號 void changeIdentify(List head,string teacherId); //更改年齡 void changeAge(List head,string teacherId); //更改教師工號 void changeTeacherId(List head,string teacherId); //更改工資 void changeSalary(List head,string teacherId); //更改課程名稱 void changeLesName(List head,string teacherId); //更改課程學分 void changePoint(List head,string teacherId); //檢索姓名 void searchName(List head); //檢索身份證號 void searchIdentify(List head); //檢索教師工號 void searchTeacherId(List head); //檢索工資 void searchSalary(List head); //檢索年齡 void searchAge(List head); //根據執教課程檢索 void searchCourseLesName(List head); //基于冒泡排序的根據教師年齡排序 List bubbleSofAge(List head); //基于冒泡排序的根據教師工號排序 List bubbleSoftTeacherId(List head); //基于冒泡排序的根據教師工資排序 List bubbleSoftSalary(List head); #endif CHANGEACITIONS
.cpp文件:
#include"changeActions.h" #include"teacherMessage.h" #include"teacherSystem.h" //更改姓名 void changeName(List head,string teacherId){ ? ? List current=findTeacher(head,teacherId); ? ? if(current){ ? ? ? ? if(current->self.getTeacherId()==teacherId){ ? ? ? ? ? ? string Name; ? ? ? ? ? ? cout<<"請輸入新名字"<>Name; ? ? ? ? ? ? current->self.changeName(Name); ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在"< self.getTeacherId()==teacherId){ ? ? ? ? ? ? string Identify; ? ? ? ? ? ? cout<<"請輸入新身份證號"< >Identify; ? ? ? ? ? ? current->self.changeIdentify(Identify); ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在"< self.getTeacherId()==teacherId){ ? ? ? ? ? ? string Age; ? ? ? ? ? ? cout<<"請輸入新年齡"< >Age; ? ? ? ? ? ? current->self.changeAge(Age); ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在"< self.getTeacherId()==teacherId){ ? ? ? ? ? ? string TeacgerId; ? ? ? ? ? ? cout<<"請輸入新教師工號"< >TeacgerId; ? ? ? ? ? ? current->self.changeTeacherId(TeacgerId); ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在"< self.getTeacherId()==teacherId){ ? ? ? ? ? ? string Salary; ? ? ? ? ? ? cout<<"請輸入新工資"< >Salary; ? ? ? ? ? ? current->self.changeSalary(Salary); ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在"< self.getTeacherId()==teacherId){ ? ? ? ? ? ? string LesName; ? ? ? ? ? ? cout<<"請輸入新課程名稱"< >LesName; ? ? ? ? ? ? current->self.changeCoureseLesName(LesName); ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在"< self.getTeacherId()==teacherId){ ? ? ? ? ? ? string Point; ? ? ? ? ? ? cout<<"請輸入新課程學分"< >Point; ? ? ? ? ? ? current->self.changeCouresePoint(Point); ? ? ? ? }else{ ? ? ? ? ? ? cout<<"該教師不存在"< >Name; ?? ? ? ? cout<<"---------------------------------------------------------------------------"< self.getName()==Name){ ? ? ? ? ? ? ? ? current->self.showmessage(); ?? ??? ??? ??? ?cout< next; ? ? ? ? } ? ? }else{ ? ? ? ? cout<<"該表格為空!"< >Identify; ?? ? ? ? cout<<"---------------------------------------------------------------------------"< self.getIdentify()==Identify){ ? ? ? ? ? ? ? ? current->self.showmessage(); ?? ??? ??? ??? ?cout< next; ? ? ? ? } ? ? }else{ ? ? ? ? cout<<"該表格為空!"< >teacherId; ?? ? ? ? cout<<"---------------------------------------------------------------------------"< self.getTeacherId()==teacherId){ ? ? ? ? ? ? ? ? current->self.showmessage(); ?? ??? ??? ??? ?cout< next; ? ? ? ? } ? ? }else{ ? ? ? ? cout<<"該表格為空!"< >salary; ?? ? ? ? cout<<"---------------------------------------------------------------------------"< self.getSalary()==salary){ ? ? ? ? ? ? ? ? current->self.showmessage(); ?? ??? ??? ??? ?cout< next; ? ? ? ? } ? ? }else{ ? ? ? ? cout<<"該表格為空!"< >age; ?? ?//輸出樣式 ? ? cout<<"---------------------------------------------------------------------------"< self.getAge()==age){ ? ? ? ? ? ? ? ? current->self.showmessage(); ?? ??? ??? ??? ?cout< next; ? ? ? ? } ? ? }else{ ? ? ? ? cout<<"該表格為空!"< >LesName; ?? ?//輸出樣式 ? ? cout<<"---------------------------------------------------------------------------"< self.getCourseLesName()==LesName){ ? ? ? ? ? ? ? ? current->self.showmessage(); ?? ??? ??? ??? ?cout< next; ? ? ? ? } ? ? }else{ ? ? ? ? cout<<"該表格為空!"< next; ? ? } ?? ?current=head;? ?? ?//排序 ? ? for(int i=0;i next){ ?? ??? ??? ?record=current->next; ?? ??? ??? ?if(record->self.getAge() self.getAge()){ ?? ??? ??? ??? ?T=record->self; ?? ??? ??? ??? ?record->self=current->self; ?? ??? ??? ??? ?current->self=T; ?? ??? ??? ?} ?? ??? ??? ?current=current->next; ? ? ? ? } ?? ??? ?current=head; ? ? ? ? } ? ? return head; } //基于冒泡排序的根據教師工號排序 List bubbleSoftTeacherId(List head){ ?? ?Teacher T; ? ? int n=0; ? ? List current=head,record; ?? ?//統計一共有多少人數 ? ? while(current){ ? ? ? ? n++; ? ? ? ? current=current->next; ? ? } ?? ?current=head;? ?? ?//排序 ? ? for(int i=0;i next){ ?? ??? ??? ?record=current->next; ?? ??? ??? ?if(record->self.getTeacherId() self.getTeacherId()){ ?? ??? ??? ??? ?T=record->self; ?? ??? ??? ??? ?record->self=current->self; ?? ??? ??? ??? ?current->self=T; ?? ??? ??? ?}? ?? ??? ??? ?current=current->next; ? ? ? ? } ?? ??? ?current=head;? ? ? } ? ? return head; } //基于冒泡排序的根據教師工資排序 List bubbleSoftSalary(List head){ ?? ?Teacher T; ? ? int n=0; ? ? List current=head,record; ?? ?//統計一共有多少人數 ? ? while(current){ ? ? ? ? n++; ? ? ? ? current=current->next; ? ? } ?? ?current=head;? ?? ?//排序//排序 ? ? for(int i=0;i next){ ?? ??? ??? ?record=current->next; ?? ??? ??? ?if(record->self.getSalary() self.getSalary()){ ?? ??? ??? ??? ?T=record->self; ?? ??? ??? ??? ?record->self=current->self; ?? ??? ??? ??? ?current->self=T; ?? ??? ??? ?}? ?? ??? ??? ?current=current->next; ? ? ? ? } ?? ??? ?current=head;? ? ? } ? ? return head; }
教師類定義代碼如下
.h文件
#ifndef TEACHERMESSAGE #define TEACHERMESSAGE #include"stdc++.h" using namespace std; //課程類 class Lesson{ ? ? private: ? ? string LesName; ? ? string Point; ? ? public: ? ? Lesson(){} ? ? ~Lesson(){} ? ? public: ? ? //傳輸數據 ? ? void getData(string LesName,string Point); ? ? //輸出樣式 ? ? void LesInterFace(); ? ? //更改課程名稱 ?? ?void changeLesName(string LesName); ? ? //更改學分 ?? ?void changePoint(string Point); ? ? //獲取課程名稱 ?? ?string getLesName(); ? ? //獲取學分 ?? ?string getPoint(); }; //人員類 class Person{ ? ? ? ? protected: ? ? ? ? string Name; ? ? ? ? string Identify; ? ? ? ? string Age; ?? ??? ?Lesson course; ? ? ? ? public: ? ? ? ?? ? ? ? ? Person(){} ? ? ? ? ~Person(){} ? ? ? ? public: ?? ??? ?//傳輸數據 ? ? ? ? void getData(string Name,string Identity,string Age,Lesson course); ?? ??? ?//輸出數據 ? ? ? ? void showmessage(); ?? ??? ?//更改姓名 ? ? ? ? void changeName(string name); ?? ??? ?//更改身份證 ? ? ? ? void changeIdentify(string Identify); ?? ??? ?//更改年齡 ? ? ? ? void changeAge(string Age); ?? ??? ?//更改課程名稱 ?? ??? ?void changeCoureseLesName(string LesName); ?? ??? ?void changeCouresePoint(string Point); ?? ??? ?//獲取姓名 ?? ??? ?string getName(); ?? ??? ?//獲取身份證號 ?? ??? ?string getIdentify(); ?? ??? ?//獲取年齡 ?? ??? ?string getAge(); ?? ??? ?//獲取課程名稱 ?? ??? ?string getCourseLesName(); ? ? }; //教師類 class Teacher:public Person{ ? ? protected: ? ? string teacherId; ? ? string salary; ? ? public: ? ? Teacher(){} ? ? ~Teacher(){} ? ? public: ?? ?//傳輸數據 ? ? void getData(string Name,string Identity,string Age,string teacherId,string salary,Lesson course); ?? ?//輸出 ? ? void showmessage(); ?? ?//更改教師工號 ? ? void changeTeacherId(string teacherId); ?? ?//更改工資 ? ? void changeSalary(string salary); ?? ?//獲取教師工號 ?? ?string getTeacherId(); ?? ?//獲取工資 ?? ?string getSalary(); }; #endif
.cpp文件
#include"teacherMessage.h" //傳輸數據 void Person::getData(string Name,string Identity,string Age,Lesson course){ ? ? this->Name=Name; ? ? this->Identify=Identity; ? ? this->Age=Age; ?? ?this->course=course; } //輸出數據 void Person::showmessage(){ ? ? cout<<" "<Name<<" ? ? ?"< Identify<<" ? ? ? ? ? ? "< Age; } //更改姓名 void Person::changeName(string Name){ ? ? this->Name=Name; } //更改身份證 void Person::changeIdentify(string Identify){ ? ? this->Identify=Identify; } //更改年齡 void Person::changeAge(string Age){ ? ? this->Age=Age; } //更改課程名稱 void Person::changeCoureseLesName(string LesName){ ?? ?this->course.changeLesName(LesName); } void Person::changeCouresePoint(string Point){ ?? ?this->course.changePoint(Point); } //獲取年齡 string Person::getAge(){ ?? ?return this->Age; } //獲取姓名 string Person::getName(){ ?? ?return this->Name; } //獲取身份證號 string Person::getIdentify(){ ?? ?return this->Identify; } //獲取課程名稱 string Person::getCourseLesName(){ ?? ?return this->course.getLesName(); } //傳輸數據 void Teacher::getData(string Name,string Identity,string Age,string teacherId,string salary,Lesson course){ ? ? Person::getData(Name,Identity,Age,course); ? ? this->teacherId=teacherId; ? ? this->salary=salary; } //輸出 void Teacher::showmessage(){ ? ? Person::showmessage(); ? ? cout<<" ? ? "< course.LesInterFace(); } //更改工資 void Teacher::changeSalary(string salary){ ? ? this->salary=salary; } //更改教師工號 void Teacher::changeTeacherId(string teacherId){ ? ? this->teacherId=teacherId; } //獲取教師工號 string Teacher::getTeacherId(){ ?? ?return this->teacherId; } //獲取工資 string Teacher::getSalary(){ ?? ?return this->salary; } void Lesson::getData(string LesName,string Point){ ?? ?this->LesName=LesName; ?? ?this->Point=Point; } void Lesson::changeLesName(string LesName){ ?? ?this->LesName=LesName; } void Lesson::changePoint(string Point){ ?? ?this->Point=Point; } string Lesson::getLesName(){ ?? ?return this->LesName; } string Lesson::getPoint(){ ?? ?return this->Point; } void Lesson::LesInterFace(){ ?? ?cout< LesName<<" ? ? ?"< Point; }
程序已經基本完成,但是不知道為什么在文件讀入那邊讀取第二次時程序會崩潰,這個問題亟待解決。
這個問題已經解決,是之前的代碼在讀取第二次的時候還是從head開始,導致一個空間被分配了兩次,這樣是不行,修改代碼以后程序能正常運行了。現在的代碼都是正確代碼。
這個程序寫了兩天,算不上很長,但是也不短了,這其實是一個很簡單的程序,主要是使用vs code來寫,然后用VC6.0進行編譯,很多問題沒辦法一下子找到,要慢慢的去一個地方一個地方的測試,花費了很多時間,幾個比較復雜的功能完成以后,后面就駕輕就熟了,這個程序算是第二次寫,之前有說要用更好的方法完成,確實也做到了,雖然不是很完善,不過下一次就打算使用QT來寫圖形界面程序。
原文鏈接:https://blog.csdn.net/TeqGin/article/details/92760558
相關推薦
- 2022-12-08 python第三方庫easydict的使用實例詳解_python
- 2021-12-16 .NET中的狀態機庫Stateless的操作流程_實用技巧
- 2022-07-04 教你在容器中使用nginx搭建上傳下載的文件服務器_nginx
- 2023-05-16 Golang函數這些神操作你知道哪些_Golang
- 2022-09-25 python?opencv實現圖像矯正功能_python
- 2023-12-18 Path環境變量點編輯無法展開
- 2022-12-12 Android?SharedPreferences數據存儲詳解_Android
- 2022-11-22 GoLang?channel使用介紹_Golang
- 最近更新
-
- window11 系統安裝 yarn
- 超詳細win安裝深度學習環境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區別,Jav
- spring @retryable不生效的一種
- Spring Security之認證信息的處理
- Spring Security之認證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權
- redisson分布式鎖中waittime的設
- maven:解決release錯誤:Artif
- restTemplate使用總結
- Spring Security之安全異常處理
- MybatisPlus優雅實現加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務發現-Nac
- Spring Security之基于HttpR
- Redis 底層數據結構-簡單動態字符串(SD
- arthas操作spring被代理目標對象命令
- Spring中的單例模式應用詳解
- 聊聊消息隊列,發送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠程分支