当前位置:首页 > 通信资讯 > 正文

c++做学生管理系统(C++学生管理系统)

本文实例为大家分享了C++实现学生管理系统的具体代码,供大家参考,具体内容如下

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 #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; }

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持服务器之家。

原文链接:https://blog.csdn.net/weixin_45541679/article/details/107248807

如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。