1. 程式人生 > 程式設計 >C++實現學生管理系統

C++實現學生管理系統

本文例項為大家分享了本文例項為大家分享了Android九宮格圖片展示的具體程式碼,供大家參考,具體內容如下的具體程式碼,供大家參考,具體內容如下

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <iostream.h>

// 學生資訊結構體
typedef struct _STRU_STU_SCORE_{
 unsigned int nStuId;
 char cpName[256];
 unsigned short nScoreChinese;
 unsigned short nScoreMath;
 unsigned short nScoreEnglish;
} STRU_STU_SCORE;

void PrintHelp()
{
 cout<<"\n//**************************************************************************//\n";
 cout<<"//************* 學  生  成  績  管  理  系  統  *****************//\n";
 cout<<"//**************************************************************************//\n";

 cout<<"(1)插入一條紀錄,請輸入i或I;\n(2)刪除一條紀錄,請輸入d或D;\n";
 cout<<"(3)修改紀錄,請輸入m或M;\n(4)查詢紀錄,請輸入g或G;\n";
 cout<<"(5)顯示所有紀錄,請輸入a或A;\n(6)顯示不及格紀錄,請輸入f或F;\n";
 cout<<"(7)顯示幫助檔案,請輸入h或H;\n(8)刪除所有紀錄,請輸入c或C。\n";
 cout<<"(9)退出,請輸入q或Q。\n";

 cout << flush;

 return;
}

int InsertRecord()
{
 STRU_STU_SCORE e;
 int rslt;

 cout<<"\n請輸入紀錄的各個資訊:\n";

 cout<<"\n學號:";
 cin>>e.nStuId;

 cout<<"\n姓名:";
 cin >> e.cpName;

 cout<<"\n語文成績:";
 cin >> e.nScoreChinese;

 cout<<"\n數學成績:";
 cin >> e.nScoreMath;

 cout<<"\n英語成績:";
 cin >> e.nScoreEnglish;

 // 插入連結串列
 // 呼叫連結串列的Insert操作程式碼

 rslt = 0; /* 插入結果 */
 if (rslt == 0)
 {
 cout << endl << "插入紀錄成功!";
 }
 else
 {
 cout << endl << "\n插入紀錄失敗!";
 }

 cout << flush;

 return 0;
}

int QueryAllRecord()
{
 //列印所有學生的成績資訊。
 cout << "\n列印所有學生的成績資訊。\n";

 cout << endl;
 cout << endl;
 cout << "\n學號 姓名 語文 數學 英語\n";

 // 顯示所有學生資訊

 cout << endl;
 cout << endl;

 cout << flush;

 return 0;
}

int QueryRecord()
{
 STRU_STU_SCORE e;

 cout << "\n請輸入要查詢紀錄的學號:";
 cin >> e.nStuId;

 cout << endl;
 cout << endl;

 cout << "\n學號 姓名 語文 數學 英語\n";
 // 顯示所查學生資訊

 cout << endl;
 cout << endl;

 cout << flush;

 return 0;
}

int DelRecord()
{
 unsigned int stuid;

 cout << "\n請輸入要刪除紀錄的學號:";
 cin >> stuid;

 // 刪除記錄程式碼

 return 0;
}

int ModifyRecord()
{
 STRU_STU_SCORE e;

 cout << "\n請輸入紀錄的各個資訊:\n";

 cout << "\n學號:";
 cin >> e.nStuId;

 cout << "\n姓名:";
 cin >> e.cpName;

 cout << "\n語文成績:";
 cin >> e.nScoreChinese;

 cout << "\n數學成績:";
 cin >> e.nScoreMath;

 cout << "\n英語成績:";
 cin >> e.nScoreEnglish;

 // 修改記錄程式碼

 return 0;
}

int QueryFailedRecord()
{
 //列印所有不及格學生的成績資訊。
 cout << "\n列印所有學生的成績資訊。\n";

 cout << endl;
 cout << endl;
 cout << "\n學號 姓名 語文 數學 英語\n";

 // 查詢顯示不及格學生資訊程式碼

 cout << endl;
 cout << endl;
 cout << flush;

 return 0;
}

int main()
{
 char cSelection;

 PrintHelp();

 while (1)
 {
 printf("\n請輸入您的選擇(i,d,m,g,a,f,h,c或q):");

 cSelection = getche();
 switch(cSelection)
 {
 case 'i':
 case 'I':
  {
  InsertRecord();
  break;
  }

 case 'd':
 case 'D':
  {
  DelRecord();
  break;
  }

 case 'm':
 case 'M':
  {
  ModifyRecord();
  break;
  }

 case 'g':
 case 'G':
  {
  QueryRecord();
  break;
  }

 case 'a':
 case 'A':
  {
  QueryAllRecord();
  break;
  }

 case 'f':
 case 'F':
  {
  QueryFailedRecord();
  break;
  }

 case 'c':
 case 'C':
  {

//  DeleteAll();;
  break;
  }

 case 'q':
 case 'Q':
  {
//  DestroyList();;
  break;
  }

 case 'h':
 case 'H':
  {
  PrintHelp();
  break;
  }

 default:
  {
  break;
  }
 }

 if (cSelection == 'q' || cSelection == 'Q')
 {
  break;
 }
 }

 return 0;
}

推薦幾篇文章:

C++實現簡單的圖書管理系統

C++實現簡單的職工資訊管理系統

C++基礎學生管理系統

關於管理系統的更多內容請點選《管理系統專題》進行學習

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