欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

C++實現(xiàn)學生選課系統(tǒng)

 更新時間:2019年02月19日 11:50:10   作者:transportation111  
這篇文章主要為大家詳細介紹了C++實現(xiàn)學生選課系統(tǒng),具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了C++實現(xiàn)學生選課系統(tǒng)的具體代碼,供大家參考,具體內容如下

#include <iostream>
#include <iomanip> 
#include <fstream>
#include<Windows.h>
#include<cstring>
using namespace std;

struct SubList/*某個學生所學的課程中的某一個 */
{
 int num; /*課程代號 */
 SubList *next;  /*指向下一個課程的指針*/
 SubList() :num(-1), next(NULL){} /*構造函數(shù)*/
};
struct StuList /*課程中所選的學生*/
{
 int num;   /* 學生的學號*/
 float score;   /*學生所得的該課程分數(shù)*/
 StuList *next; /*下一個學生*/
 StuList() :num(-1), score(0), next(NULL){}
};
class Student 
{
private:
 int Num;  /*學號*/
 char Name[20];    /*學生的姓名 */
 int MaxSubNum;   /*學生最多可以學五門課程 */
 int FactSubNum;   /* 學生實際所學的課程數(shù)目 */
 SubList *Root;   /*課程的指針*/
 float SumXueFen; /*總的選課學分*/
 float FactXueFen; /*實際獲得學分*/
 float SumGrade; /*總成績*/
 bool Update; /*是否需要更新信息*/
public:
 Student *next;/*讓所有學生的信息連接起來*/
 SubList *GetSubPtr()const{ return Root; }/*獲取所選的課程表*/
 Student() :Update(false), Root(new SubList()), FactXueFen(0), MaxSubNum(5), FactSubNum(0), SumXueFen(0), SumGrade(0),next(NULL){}
 void SetName(char N[]){ strcpy(Name, N); } /* 設置學生的姓名 */
 void SetNum(int num){ Num = num; } /*設置學號*/
 const char* GetName()const{ return Name; }/*得到學生的姓名 */
 int GetNum()const{ return Num; } /*得到學號*/
 int GetFactSubNum()const{ return FactSubNum; } /*得到實際選課數(shù)*/
 bool FindSub(int num)const;  /*查找是否已有此課程,如果有返回,如果沒有返回 */
 void SetInfo(float sumXueFen, float factXueFen, float sumGrade)
 {
 SumXueFen = sumXueFen;/*這三條信息因為一起用 所以一起設置了*/
 FactXueFen = factXueFen;
 SumGrade = sumGrade;
 }
 void SetUpdate(bool t){ Update = t; }/*是否更新信息的標志*/
 float GetAveGrade(){ return SumGrade / FactSubNum; }  /*學生課程的平均成績*/
 void AddSub(int num); /*增加課程*/
 bool IsFull()const{ return MaxSubNum == FactSubNum; }
 void ShowStuInfo(); /*輸出學生信息*/
 void DelSub(int num); /*刪除課程 Manage類使用*/
 ~Student()/*析構函數(shù) 不要也行影響不太大 一般程序,還不太會內存用完*/
 {
 SubList *p = Root;
 while (p)
 {
  SubList*t = p->next;
  delete p;
  p = t;
 }
 }
};
//課程類 
class Subject
{
private:
 int MaxStuNum;  /*最多學生數(shù)*/
 int FactStuNum;  /*實際學生數(shù)*/
 float Credit;  /*該課程的學分 */
 char Name[20]; /* 該課程的名稱 */
 int Num; /*課程的代號*/
 StuList *Root; /* 學生名單 */
 float AveGrade; /*該課程的平均成績 */
 bool Update; /*是否更新信息*/
public:
 StuList *GetStuPtr()const{ return Root; }/*獲取選此課程的學生表*/
 Subject*next;
 Subject() :Root(new StuList()), MaxStuNum(30), FactStuNum(0), Update(false),next(NULL){}
 float GetCredit()const{ return Credit; }  //得到課程的學分 
 void SetCredit(float credit){ Credit = credit; } //設置學分
 const char* GetName()const{ return Name; } //讀出課程的名稱
 void SetName(char N[]){ strcpy(Name, N); } //設置課程的名稱
 int GetNum()const{ return Num; } //讀出課程的代號
 void SetNum(int num){ Num = num; } //設置課程的代號
 int GetFactStuNum()const{ return FactStuNum; } //返回實際學生數(shù) 
 int GetMaxStuNum()const{ return MaxStuNum; }//最大學生數(shù)
 void SetUpdate(bool t){ Update = t; }
 void SetAveGrade(float num){ AveGrade = num/FactStuNum; } //設置平均分
 float GetAveGrade(){ return AveGrade; }  //得到學生的平均成績
 float GetStuScore(int num); //查找某個學生的成績
 bool IsFull()const{ return MaxStuNum == FactStuNum; }//是否人數(shù)已滿
 void DelStu(int num);//刪除學生
 void AddStu(int num);//增加學生
 ~Subject()
 {
 StuList *p = Root;
 while (p)
 {
  StuList*t = p->next;
  delete p;
  p = t;
 }
 }
};

float Subject::GetStuScore(int num)
{
 StuList*p = Root->next;
 while (p->num != num)
 p = p->next;
 return p->score;
}

void Student::ShowStuInfo()
{
 cout << Num << " " << Name << " " << "選課數(shù):" << FactSubNum << endl;
 cout << "\t\t 總成績" << SumGrade << " 平均分" << GetAveGrade() << endl;
 cout << "\t\t課程總學分" << SumXueFen << " 獲得學分" << FactXueFen << endl; 
 system("pause");
}

bool Student::FindSub(int num)const//查找是否已有此課程,如果有返回,如果沒有返回
{
 bool t = false;
 SubList *p = Root->next;
 while (!t && p)
 {
 if (p->num == num)
  t = true;
 p = p->next;
 }
 return t;
}

void Student::AddSub(int num)//給學生增加一門課 
{
 SubList *s = new SubList(), *p = Root;
 while (p->next)
 p = p->next;
 p->next = s;
 s->num = num;
 FactSubNum++;
 Update = true;
}

void Student::DelSub(int num)
{
 SubList*p = Root, *t;

 while (p->next->num != num)
 p = p->next;
 t = p->next;
 p->next = t->next;

 FactSubNum--;
 Update = true;
 delete t;
}
//////////////////////////Subject//////////////////////////////////
void Subject::AddStu(int num)// 
{
 StuList *s = new StuList(), *p = Root;
 while (p->next)
 p = p->next;
 p->next = s;
 s->num = num;
 FactStuNum++;
 Update = true;
}

void Subject::DelStu(int num)
{
 StuList*p = Root, *t;

 while (p->next->num != num)
 p = p->next;
 t = p->next;
 p->next = t->next;

 FactStuNum--;
 Update = true;
 delete t;
}

//////////////////////////////////////////////////////////
class Manage
{
private:
 Student*StuRoot;
 Subject*SubRoot;
 bool Update;
public:
 Manage() :StuRoot(new Student()), SubRoot(new Subject()),Update(false){}
 Manage(const Manage&p){}
 void AddStu();
 void AddSub();

 Student*FindStu(int num);
 Subject*FindSub(int num);

 int ShowSub()const;//顯示可選課程
 int ShowStu()const;
 void ShowStuSubInfo(Student*p);

 void DelStu(Student*p);
 void DelSub(Subject*p);

 void Start();
 int menu();
 int custom();
 int server();

 Student* password1();
 bool password2();

 void menu_1_1(Student*p);

 void menu_2_1();
 void menu_2_2();
 void menu_2_3();
 void menu_2_4();
 void menu_2_5();
 void menu_2_6();
 void menu_2_7();
 void menu_2_8();
 void menu_2_9();

 void IsUpdate()
 {
 if (Update == true)
 {
  Student*p = StuRoot->next;
  Subject*q = SubRoot->next;
  while (q)
  {
  float sum = 0;
  StuList *t =q->GetStuPtr()->next;
  while (t)
  {
   sum += t->score;
   t = t->next;
  }
  q->SetAveGrade(sum);
  q->SetUpdate(false);
  q = q->next;
  }
  while (p)
  {
  float sum = 0, xuefen = 0, xuefen1 = 0;
  SubList *t = p->GetSubPtr()->next;
  while (t)
  {
   Subject*tt = FindSub(t->num);
   xuefen += tt->GetCredit();

   float f = tt->GetStuScore(p->GetNum());
   sum += f;
   if (f>= 60)
   xuefen1 += tt->GetCredit();
   t = t->next;
  }
  p->SetInfo(xuefen, xuefen1, sum);
  p->SetUpdate(false);
  p= p->next;
  }
  Update = false;
 }
 }
};

void Manage::DelStu(Student*p)
{
 SubList *l = p->GetSubPtr()->next;
 while (l)
 {
 FindSub(l->num)->DelStu(p->GetNum());
 l = l->next;
 }

 Student*t = StuRoot;
 while (t->next != p)
 t = t->next;
 t->next = p->next;
 delete p;
 Update = true;
}

void Manage::DelSub(Subject*p)
{
 StuList *l = p->GetStuPtr()->next;
 while (l)
 {
 FindStu(l->num)->DelSub(p->GetNum());
 l = l->next;
 }

 Subject*t = SubRoot;
 while (t->next != p)
 t = t->next;
 t->next = p->next;
 delete p;
 Update = true;
}

int Manage::ShowSub()const
{
 Subject*p = SubRoot->next;
 int n = 0;
 while (p)
 {
 cout << p->GetNum() << " " << p->GetName() << " 學分:" << p->GetCredit() << endl;
 n++;
 p = p->next;
 }
 return n;
}

int Manage::ShowStu()const
{
 Student*p = StuRoot->next;
 int n = 0;
 while (p)
 {
 cout << p->GetNum() << " " << p->GetName() << endl;
 n++;
 p = p->next;
 }
 return n;
}

Student*Manage::FindStu(int num)
{
 Student*p = StuRoot->next;
 while (p)
 {
 if (p->GetNum() == num)
  break;
 p = p->next;
 }
 return p;
}

Subject*Manage::FindSub(int num)
{
 Subject*p = SubRoot->next;
 while (p)
 {
 if (p->GetNum() == num)
  break;
 p = p->next;
 }
 return p;
}

//總菜單 
int Manage::menu()
{
 int k = 0, n;
 while (1)
 {
 system("cls");
 cout << endl << endl;
 cout << "*******************************************\n"
  << "*                     *\n"
  << "*       學生選修課系統(tǒng)       *\n"
  << "*                     *\n"
  << "*   操作方式:              *\n"
  << "*        1.選修課系統(tǒng)學生端    *\n"
  << "*                     *\n"
  << "*        2.選修課系統(tǒng)管理端    *\n"
  << "*        0. 退出          *\n"
  << "*******************************************\n"
  << endl;
 cout << "\n\t\t請選擇登入方式: ";

 cin >> n;
 if (n > -1 && n < 3)
  return n;
 else
 {
  cerr << "\n\n\t\t\t\t輸入有誤!\n" << endl;
  k++;
 }
 if (k == 3)
 {
  cerr << "\n\n\n\t\t~~提示~~:錯誤輸入次數(shù)超過三次,你將被強制退出!!\n\n" << endl;
  return 0;
 }
 system("pause");
 }
}

//選修課系統(tǒng)端操作 
int Manage::custom()
{
 int n, k = 0;
 while (1)
 {
 system("cls");;
 cout << "\n\n\n" << "※※※※※※※※※※※※※※※※※※※※※※※※※※\n"
  << "※        選修課系統(tǒng)學生端        ※\n"
  << "※                        ※\n"
  << "※          操作方式:.         ※\n"
  << "※          1、 學生選課         ※\n"
  << "※          2、 學生情況         ※\n"
  << "※          3、 選課情況         ※\n"
  << "※          4、 退出系統(tǒng)         ※\n"
  << "※                        ※\n"
  << "※※※※※※※※※※※※※※※※※※※※※※※※※※\n" << endl;
 cout << "\t\t\t請選擇操作方式: ";
 cin >> n;
 if (n > 0 && n < 5)
  return n;
 else
 {
  cerr << "\n\t\t\t\t輸入有誤!請重新輸入\n" << endl;
  k++;
 }
 if (k == 3)
 {
  system("cls");
  cerr << "錯誤輸入超過三次!你將被強制退出!!\n" << endl;
  return 4;
 }
 system("pause");
 }
}

int Manage::server()
{
 int n, k = 0;
 while (1)
 {
 system("cls");;
 cout << "\n\n\n" << "※※※※※※※※※※※※※※※※※※※※※※※※※\n"
  << "※                       ※\n"
  << "※         選修課系統(tǒng)管理端       ※\n"
  << "※                       ※\n"
  << "※  操作方式:                 ※\n"
  << "※      1.增加學生   2.增加課程     ※\n"
  << "※      3.刪除學生   4.刪除課程     ※\n"
  << "※      5.填寫成績   6.更改學分     ※\n"
  << "※      7.學生情況   8.選課情況     ※\n"
  << "※      9.保存數(shù)據(jù)   0.退出系統(tǒng)     ※\n"
  << "※                       ※\n"
  << "※※※※※※※※※※※※※※※※※※※※※※※※※\n" << endl;
 cout << "\t\t 請選擇操作方式: " << endl;
 cin >> n;
 if (n > -1 && n < 10)
  return n;
 else
 {
  cerr << "\n\t\t\t\t輸入有誤!\n" << endl;
  k++;
 }
 if (k == 3)
 {
  cerr << "錯誤輸入超過三次!\n";
  return 0;
 }
 system("pause");
 }
}

Student* Manage::password1()
{
 system("cls");
 int k = 0;
 int num;
 while (1)
 {
 cout << "請輸入你的學號:" << endl;
 cin >> num;
 Student*p = FindStu(num);
 if (p == NULL)
 {
  cout << "無此學號!!請重新輸入 " << endl;
  k++; 
  system("pause");
 }
 else
 {
  cout << "你的名字為:" << p->GetName() << endl;
  cout << "請按任意鍵進入選課系統(tǒng)" << endl;
  return p;
 }
 if (k >= 3)
 {
  system("cls");
  cerr << "\n\n\t\t\t輸入錯誤密碼超過三次!請按任意鍵退出.." << endl;
  return NULL;
 }
 
 }
}
//密碼檢查 
bool Manage::password2()
{
 int k = 0, i;
 const char A[] = "admin";
 char B[10];

 system("cls");
 for (i = 0; i < 8; i++)
 cout << endl;

 while (1)
 {
 printf("\t\t\t請輸入管理員密碼:");
 i = 0;
 cin >> B;
 if (strcmp(A, B) == 0)
  return true;
 else
 {
  k++;
  cerr << "\n\n\t\t\t密碼輸入錯誤!請重新輸入!\n" << endl;
  system("pause");
 }
 if (k ==3)
 {
  system("cls");
  cerr << "\n\n\t\t\t輸入錯誤密碼超過三次!請按任意鍵退出.." << endl;
  return false;
 }
 }
}
void Manage::Start()
{
 int n = 1;
 while (n)
 {
 n = menu();
 if (n == 1)
 {
  Student*p = password1();
  while (p)
  {

  int c = custom();

  switch (c)
  {
  case 1: menu_1_1(p); break;//學生選課  

  case 2:p->ShowStuInfo(); break;//學生情況 

  case 3:ShowStuSubInfo(p);; break;//選課情況 

  }
  IsUpdate();
  if (c == 4) break;//退出系統(tǒng) 
  }
  if (p == NULL)
  n = 0;
 }
 else if (n == 2)
 {
  bool t = password2();
  while (t)
  {
  int c = server();
  switch (c)
  {
  case 1:menu_2_1();  break;  //增加學生 
  case 2:menu_2_2(); break;  //增加課程 
  case 3: menu_2_3(); break;  //刪除學生  
  case 4:menu_2_4();  break;  //刪除課程  
  case 5: menu_2_5(); break;  //填寫成績 
  case 6: menu_2_6(); break;  //更改學分 
  case 7:menu_2_7();  break;  //學生情況 
  case 8:menu_2_8();  break;  //選課情況 
  case 9: menu_2_9(); break;  //保存數(shù)據(jù) 
  }
  IsUpdate();
  if (c == 0)   break;  //退出系統(tǒng) 
  }
  if (!t)
  n = 0;
 }
 }
}

//學生端功能函數(shù) 
void Manage::menu_1_1(Student*p)  //學生選課
{
 if (p->IsFull())
 cout << "你的課程已經(jīng)選滿了" << endl;
 else
 {
 int num;
 if (ShowSub()==0)
  cout << "無課程可以選擇" << endl;
 else
 {
  cout << "請輸入你的選擇" << endl;
  cin >> num;
  if (p->FindSub(num))
  cout << "此課程你已經(jīng)選擇" << endl;
  else if (FindSub(num)->IsFull())
  cout << "課程人數(shù)已滿" << endl;
  else
  {
  p->AddSub(num);
  FindSub(num)->AddStu(p->GetNum());
  cout << "選課成功" << endl;
  }
 }
 }
 Update = true;
 system("pause");
}

void Manage::ShowStuSubInfo(Student*p)
{
 SubList*l = p->GetSubPtr()->next;
 cout << p->GetNum() << " " << p->GetName() << " 選課數(shù)" << p->GetFactSubNum() << endl;
 while (l)
 {
 Subject*s = FindSub(l->num);
 cout << "\t\t" << s->GetNum() << " " << s->GetName() << " " << s->GetCredit() << endl;
 float f = s->GetStuScore(p->GetNum());
 cout << "\t\t 成績 " << f << endl;
 cout << "------------------------------" << endl;
 l = l->next;
 }
}

//管理端功能函數(shù)
void Manage::menu_2_1()  //增加學生 
{
 system("cls");
 int num;
 char name[20];

 cout << "\n\n\t\t\t\t增加學生操作\n" << endl;

 cout << "\n\n\t\t請輸入學生學號:";
 cin >> num;

 if (FindStu(num))
 cout << "學生已經(jīng)存在" << endl;
 else
 {
 cout << "\n\n\t\t請輸入學生姓名:";
 cin >> name;
 Student*p = new Student();
 p->SetNum(num);
 p->SetName(name);
 Student *root = StuRoot;
 while (root->next)
  root = root->next;
 root->next = p;
 cout << endl << "\t\t增加學生操作成功,按任意鍵繼續(xù)" << endl;
 }
 system("pause");
}

void Manage::menu_2_2()  //增加課程 
{
 system("cls");
 int num;
 float credit;
 char name[20];
 cout << "\n\n\t\t\t\t增加課程操作\n" << endl;
 cout << "\n\n\t\t 請輸入課程代號:";
 cin >> num;
 if (FindSub(num))
 cout << "\n\t\t此課程已經(jīng)存在,按任意鍵繼續(xù)" << endl;
 else
 {
 cout << "\n\n\t\t請輸入課程名:";
 cin >> name;
 cout << "請輸入課程學分" << endl;
 cin >> credit;
 Subject*p = new Subject();
 p->SetNum(num);
 p->SetName(name);
 p->SetCredit(credit);
 Subject *root = SubRoot;
 while (root->next)
  root = root->next;
 root->next = p;
 cout << endl << "\t\t增加課程操作成功,按任意鍵繼續(xù)" << endl;
 }
 system("pause");
}

void Manage::menu_2_3() //刪除學生 
{
 system("cls");
 cout << "\n\n\t\t\t\t刪除學生操作" << endl;
 if (ShowStu()==0)
 cout << "無學生" << endl;
 else
 {
 int num;
 cout << "\n\t請輸入要刪除的學生代學號:";
 cin >> num;
 Student*p = FindStu(num);
 if (p == NULL)
  cout << "無此學生" << endl;
 else
 {
  DelStu(p);
  cout << "\n\t\t刪除學生操作成功,按任意鍵繼續(xù).." << endl;
 }
 }
 system("pause");
}

void Manage::menu_2_4()  //刪除課程 
{
 system("cls");
 cout << "\n\n\t\t\t\t刪除課程操作" << endl;
 if (ShowSub()==0)
 cout << "無課程" << endl;
 else
 {
 int num;
 cout << "\n\t請輸入要刪除的課程代號:";
 cin >> num;
 Subject*p = FindSub(num);
 if (p == NULL)
  cout << "無此課程" << endl;
 else
 {
  DelSub(p);
  cout << "\n\t\t刪除課程操作成功,按任意鍵繼續(xù).." << endl;
 }
 }
 system("pause");
}

void Manage::menu_2_5()  //填寫成績 
{
 system("cls");
 cout << "\n\n\t\t\t\t 填寫成績操作\n" << endl;

 if (ShowSub()==0)
 cout << "\n\n\n\t\t對不起,暫時沒有任何選修課程。請按任意鍵繼續(xù).." << endl;
 else
 {
 int num;
 cout << "請選擇課程代號" << endl;
 cin >> num;
 Subject*p = FindSub(num);
 if (p == NULL)
  cerr << "\n\t\t沒有此課程!!請按任意鍵繼續(xù).." << endl;
 else
 {
  cout << p->GetNum() << " 課程名稱" << p->GetName() << " 選課人數(shù)" << p->GetFactStuNum() << endl;
  int n;
  cout << "請輸入1確認開始填寫成績,按其他鍵退出" << endl;
  cin >> n;
  if (n == 1)
  {
  StuList*q = p->GetStuPtr()->next;
  while (q)
  {
   Student*l = FindStu(q->num);
   cout << "\n\n\t\t請?zhí)顚? << q->num << " " << l->GetName() << "的學生成績\n" << endl;
   cin >> q->score;
   l->SetUpdate(true);
   q = q->next;
  }
  p->SetUpdate(true);
  }

 }
 }
 Update = true;
 system("pause");
}

void Manage::menu_2_6()  //更改學分 
{
 system("cls");

 cout << "\n\n\n\t\t\t\t更改學分操作\n" << endl;
 if (ShowSub()==0)
 cout << "\n\n\n\t\t對不起,暫時沒有任何課程。請按任意鍵繼續(xù).." << endl;
 else
 {
 int num;
 cout << "請選擇課程代號" << endl;
 cin >> num;
 Subject*p = FindSub(num);
 if (p == NULL)
  cout << "無此課程" << endl;
 else
 {
  float n;
  cout << "\n\t\t\t原來學分為:" << p->GetCredit() << endl;
  cout << "\n\t\t\t現(xiàn)要更改為:";
  cin >> n;
  p->SetCredit(n);

  StuList*q = p->GetStuPtr()->next;
  while (q)
  {
  FindStu(q->num)->SetUpdate(true);
  q = q->next;
  }

  cout << "\n\t\t更改課程學分成功,按任意鍵繼續(xù)" << endl;
 }
 }
 Update = true;
 system("pause");
}

void Manage::menu_2_7()
{
 Student *p = StuRoot->next;
 if (p == NULL)
 cout << "無記錄" << endl;
 else
 while (p)
 {
  ShowStuSubInfo(p);
  p = p->next;
 }
 system("pause");
}

void Manage::menu_2_8()  //選課情況
{
 system("cls");
 cout << "\n\n\t\t\t\t選課情況操作" << endl;
 if (ShowSub()==0)
 cout << "\n\n\n\t\t對不起,暫時沒有課程!!請按任意鍵繼續(xù).." << endl;
 else
 {
 int num;
 cout << "\n\t請輸入要查看的課程代號:";
 cin >> num;

 Subject*p = FindSub(num);
 if (p == NULL)
  cout << "\n\t\t無此課程!!\t請按任意鍵繼續(xù).." << endl;
 else
 {
  cout << p->GetNum() << " " << p->GetName() << " " << p->GetCredit() << endl;
  cout << "\t\t最大人數(shù):" << p->GetMaxStuNum() << " " << "實際人數(shù)" << p->GetFactStuNum() << endl;

  StuList*q = p->GetStuPtr()->next;
  while (q)
  {
  cout <<q->num << " " << FindStu(q->num)->GetName() << " " << q->score << endl;
  q = q->next;
  }
 }
 }
 system("pause");
}

 /*保存數(shù)據(jù) 不過沒有讀取函數(shù) 這個功能就沒有 讀取懶的寫了... */
void Manage::menu_2_9() 
{
 Student*p = StuRoot->next;
 ofstream o("Student.txt",32);
 ofstream oo("SubList.txt", 32);
 while (p)
 {
 SubList*t=p->GetSubPtr()->next;
 o.write(reinterpret_cast<char*>(p), sizeof(*p));
 while (t)
 {
  oo.write(reinterpret_cast<char*>(t), sizeof(*t));
  t = t->next;
 }
 p = p->next;
 }
 o.close();
 oo.close();

 Subject*q = SubRoot->next;
 o.open("Subject.txt", 32);
 oo.open("StuList.txt", 32);

 while (q)
 {
 StuList*t = q->GetStuPtr()->next;
 o.write(reinterpret_cast<char*>(q), sizeof(*q));
 while (t)
 {
  oo.write(reinterpret_cast<char*>(t), sizeof(*t));
  t = t->next;
 }
 q = q->next;
 }
 o.close();
 oo.close();
 cout << "\n\n\n\t\t\t保存數(shù)據(jù)成功!按任意鍵繼續(xù).." << endl;
 system("pause");
}

int main()
{
 Manage m;
 m.Start();
 return 0;
}

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關文章

  • C語言數(shù)據(jù)結構之順序數(shù)組的實現(xiàn)

    C語言數(shù)據(jù)結構之順序數(shù)組的實現(xiàn)

    這篇文章主要介紹了C語言數(shù)據(jù)結構之順序數(shù)組的實現(xiàn)的相關資料,這里提供實現(xiàn)實例,希望通過本文能幫助到大家,需要的朋友可以參考下
    2017-08-08
  • C語言數(shù)據(jù)結構順序表的進階講解

    C語言數(shù)據(jù)結構順序表的進階講解

    程序中經(jīng)常需要將一組數(shù)據(jù)元素作為整體管理和使用,需要創(chuàng)建這種元素組,用變量記錄它們,傳進傳出函數(shù)等。一組數(shù)據(jù)中包含的元素個數(shù)可能發(fā)生變化,順序表則是將元素順序地存放在一塊連續(xù)的存儲區(qū)里,元素間的順序關系由它們的存儲順序自然表示
    2022-04-04
  • Qt中互斥鎖QMutex和QMutexLocker的使用

    Qt中互斥鎖QMutex和QMutexLocker的使用

    本文主要介紹了Qt中互斥鎖QMutex和QMutexLocker的使用,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-05-05
  • C語言對對碰游戲源碼分享

    C語言對對碰游戲源碼分享

    這篇文章主要為大家分享了C語言對對碰游戲源碼,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-02-02
  • 使用C++實現(xiàn)全排列算法的方法詳解

    使用C++實現(xiàn)全排列算法的方法詳解

    本篇文章是對使用C++實現(xiàn)全排列算法的方法進行了詳細的分析介紹,需要的朋友參考下
    2013-05-05
  • C語言簡明講解三目運算符和逗號表達式的使用

    C語言簡明講解三目運算符和逗號表達式的使用

    三目運算符,又稱條件運算符,它是唯一有3個操作數(shù)的運算符,有時又稱為三元運算符。三目運算符的結合性是右結合的;逗號表達式,是c語言中的逗號運算符,優(yōu)先級別最低,它將兩個及其以上的式子聯(lián)接起來,從左往右逐個計算表達式,整個表達式的值為最后一個表達式的值
    2022-04-04
  • Visual Studio安裝的圖文教程

    Visual Studio安裝的圖文教程

    這篇文章主要介紹了Visual Studio安裝的圖文教程,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-02-02
  • C語言 while for do while循環(huán)體詳解用法

    C語言 while for do while循環(huán)體詳解用法

    在不少實際問題中有許多具有規(guī)律性的重復操作,因此在程序中就需要重復執(zhí)行某些語句。一組被重復執(zhí)行的語句稱之為循環(huán)體,能否繼續(xù)重復,決定循環(huán)的終止條件
    2021-10-10
  • C語言中的遞歸,你真的懂了嗎?

    C語言中的遞歸,你真的懂了嗎?

    這篇文章主要給大家介紹了關于C語言中遞歸的相關資料,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2020-11-11
  • C++中的不規(guī)則二維數(shù)組實現(xiàn)代碼

    C++中的不規(guī)則二維數(shù)組實現(xiàn)代碼

    本文介紹了一個在C++中保存不定長二維數(shù)組的數(shù)據(jù)結構,在這個結構中,我們使用了一個含有指針和數(shù)組長度的結構體,用這樣的一個結構體構造一個結構體數(shù)組,用于存儲每一個不定長的數(shù)組,感興趣的朋友一起看看吧
    2024-03-03

最新評論