学生成绩管理系统(简易本地版)
一、概述
平台:Windows 10 ,Microsoft Visual Studio 2017
语言:C++,面向过程
完成日期:2018/12/27
主要功能:
1. 添加学生的信息(包括学号,姓名,性别,成绩)
2. 显示学生的信息
3.查询学生的信息( 以学号或姓名的方式查询)
4.修改学生的信息
5.保存学生的信息(txt文件)
6.删除和排序学生的信息,暂不支持
除此外还用Windows.h头文件里面的光标定位函数做了一个键盘操作界面和小动画。
二、 用到了哪些知识?
1.C++基本的语法(结构体,函数,输入输出流,文件操作流等)
2.system函数
- 函数原型:int system(const char *command);
- 头文件:<cstdlib> 或 <process.h>
- 功能:在C++代码中执行 DOS (Disk Operation System,磁盘操作系统) 指令。
- 常用的函数:
system(“cls”) //清屏
system(“pause”) //按任意键
system(“title xxx”)//设置标题为xxx
system(“color 02”)// 黑底绿字
三、主要功能的说明
1. 头文件预览
//student.h
#pragma once
#include <iostream>
#include <cstdlib>//exit()函数
#include <Windows.h>//光标定位
#include <fstream>//C++ I/O流
#include <string>
#include <conio.h>
using namespace std;
void SetPos(COORD a);//光标定位
void SetPos(int i, int j);
void HideCursor();//隐藏光标
void show();//展现学生信息
void input();//录入信息
void search();//查找信息
void print();//保存本地txt文件
void load();//加载动画
void modify();//修改信息
void menu_flash();//菜单子模块
int menu_choose();
void theme();//选择背景色
void menu();//主菜单
void help();//开局动画之一
2.关于一些变量的说明
首先定义了一个结构体student,并申明了一个students。
struct student
{
string Number;
string Name;
string Sex;
int Clanguage;
int English;
int Math;
};
student students;
const char *txtfile = "2333.txt";//文件名
const char *datfile = "2333.dat";
ifstream a;//a和b都对dat操作
ofstream b;
ofstream d;//d对txt操作
string file;//对txt重命名
string endline = ".txt";//添加后缀,保存为txt文件时用于重命名
int ct = 1;//指针位置+1,用于修改时确认指针的位置
3.主要函数说明
(1)录入学生信息
直接打开dat文件进行输入,最后记得要关闭文件。
void input()
{
system("cls");
b.open(datfile, ios_base::binary | ios_base::out | ios_base::app);
if (!b.is_open())
{
cout << "\a文件打开失败,请稍后重试." << endl;
exit(EXIT_FAILURE);
}
int c = 1;
cout << "格式:\t";
cout << "学号\t\t姓名\t性别\t\tC++成绩\t\t英语成绩\t\t高等数学" << endl;
cout << " 各项信息间以空格隔开\n";
while (c)
{
cin >> students.Number;
cin >> students.Name;
cin >> students.Sex;
cin >> students.Clanguage;
cin >> students.English;
cin >> students.Math;
b.write((char *)&students, sizeof students);
cout << "0 ———— 退出 1 ———— 继续输入:";
cin >> c;
}
b.close();
}
(2)显示学生的信息
其中的变量ct为序号,用于修改信息时确认指针的位置。
void show()//打开dat文件并输出到界面上
{
system("cls");
ct = 1;
a.open(datfile, ios_base::binary | ios_base::in);
if (a.is_open())
{
cout << "\t\t\t学生信息表:\n\n";
cout << "序号\t学号\t\t姓名\t性别\tC++\t英语\t高等数学" << endl;
while (a.read((char *)&students, sizeof students))
{
cout << ct++ << "\t"
<< students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t"
<< students.English << "\t"
<< students.Math << endl;
}
a.close();
}
else
{
cout << "\a信息加载失败!请初始化后重试!";
}
}
(3)查询学生的信息
打开dat文件,获取学生的信息,根据用户的选择来搜索比较对应信息。如果相等,则输出该学生信息,否则代表无该学生的信息。
变量choose用来响应用户的操作(退出,姓名查找和学号查找);
变量flag用来确认是否查找成功;
最后别忘了关闭文件。
void search()//
{
system("cls");
int choose;
while (1)
{
a.open(datfile, ios_base::binary | ios_base::in);
cout << "0 ———— 退出 1 ———— 按姓名查找 2 ———— 按学号查找\n";
cin >> choose;
string name;
string num;
if (choose == 0)
{
a.close();
return;
}
if (choose == 1)
{
cout << "请输入查找姓名:";
cin >> name;
}
if (choose == 2)
{
cout << "请输入查找学号";
cin >> num;
}
if (a.is_open())
{
int flag = 0;//判断是否找到
cout << "学号\t姓名\t性别\tC++\t英语\t高等数学" << endl;
while (a.read((char *)&students, sizeof students))
{
if (choose == 1 && students.Name == name)
{
cout << students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t" << students.English << "\t"
<< students.Math << endl;
flag = 1;
}
if (choose == 2 && students.Number == num)
{
cout << students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t" << students.English << "\t"
<< students.Math << endl;
flag = 1;
}
}
if (flag == 0)
{
cout << "查询不到此信息!\n";
}
}
else
{
cout << "\a信息加载失败!请初始化后重试!";
}
a.close();
}
}
(4)修改学生的信息
变量a_1的类型为fstream,可读可写。
根据序号确认被修改的学生的信息在文件中的位置,并进行重新输入。
void modify()//修改
{
fstream a_1;
a_1.open(datfile, ios_base::in | ios_base::out | ios_base::binary);
if (a_1.is_open())
{
int point;//想修改的数字
int end = 1;//
while (end)
{
show();
cout << "0 ———— 退出";
cout << "请输入对应序号:";
cin >> point;
if (point >= 1 && point <= ct - 1)
{
streampos place = (point - 1) * sizeof students;
a_1.seekg(place);
if (a_1.fail())
{
cout << "查找错误...\n";
exit(EXIT_FAILURE);
}
a_1.read((char *)&students, sizeof students);
cout << "您即将修改的信息如下:\n";
cout << point << "\t\t"
<< students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t"
<< students.English << "\t"
<< students.Math << endl;
if (a_1.eof())
{
a_1.clear();
}
cout << "学号:________\b\b\b\b\b\b";
cin >> students.Number;
cout << "姓名:________\b\b\b\b\b\b";
cin >> students.Name;
cout << "性别:___\b\b\b";
cin >> students.Sex;
cout << "C++:___\b\b\b";
cin >> students.Clanguage;
cout << "英语:___\b\b\b";
cin >> students.English;
cout << "高等数学:___\b\b\b";
cin >> students.Math;
a_1.seekp(place);
a_1.write((char *)&students, sizeof students);
if (a_1.fail())
{
cout << "写入错误\n";
exit(EXIT_FAILURE);
}
show();
cout << "是否继续修改?\n"
<< "0 ———— 退出 1 ———— 继续";
cin >> end;
if (end == 0)
a_1.close();
system("cls");
}
else if (point == 0)
{
a_1.close();
return;
}
else
{
cout << "\a输入的数字不在有效范围" << "(" << 1 << "~" << ct - 1 << ")"
<< "内,请重新输入.\n";
system("pause");
system("cls");
}
}
}
else
{
cout << "\a无法打开" << datfile << endl;
}
}
(5)保存学生的信息
打开dat文件,创建并打开txt文件,将dat文件内的信息写入txt文件,写入后关闭dat和txt文件,完成操作。
在这里,提供了重命名操作,最终文件会以txt格式保存在程序所在的目录。
void print()
{
system("cls");
a.open(datfile, ios_base::binary | ios_base::in);
if (a.is_open())
{
cout << "文件名:" << txtfile << ",是否修改文件名?\n";
cout << " /\\ 0 ———— 否" << endl;
cout << " /!!\\ 1 ———— 是" << endl;
cout << "/ \\若文件夹中出现同名文件,可能将其覆盖.\n"
<< " ̄ ̄ ̄\n";
int answer;
while (1)//修改文件名
{
cin >> answer;
if (answer == 1)
{
cout << "请输入文件名 (不要加后缀):";
cin >> file;
d.open((file + endline), ios_base::out);
break;
}
else if (answer == 0)
{
d.open(txtfile, ios_base::out);
break;
}
else
{
cout << "输入错误,请重新输入!\n";
continue;
}
}
if (d.is_open())
{
d << "学号\t姓名\t性别\t\tC++\t\t英语\t\t高等数学\n";
while (a.read((char *)&students, sizeof students))
{
d << students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t\t"
<< students.Clanguage << "\t\t" << students.English << "\t\t"
<< students.Math << endl;
}
cout << "保存成功!";
cout << "您的文件名为" << (answer == 1 ? (file + endline) : txtfile);
cout << "请及时提取相关文件,以免文件失效或损坏\n";
d.close();
}
a.close();
}
else
{
cout << "\a文件载入失败,请稍后重试.\n";
}
}
(6)其他部分
加载动画
void load()//动画1
{
system("pause");
system("cls");
SetPos(50, 14);
string LOAD = "加载中";
cout << LOAD;
for (int i = 0; i < 6; i++)
{
Sleep(150);
cout << ".";
}
system("cls");
}
void help()//动画2
{
Sleep(100);
system("cls");
system("color 0E");
SetPos(12, 7);
cout << "☆☆★★★★★★★★★★★★★★★★★★★☆☆";
SetPos(12, 8);
cout << "☆★ ★☆";
SetPos(12, 9);
cout << "☆★ ★★★ ★★★ ★☆";
SetPos(12, 10);
cout << "☆★ ★☆☆☆★☆★☆☆☆★ ★☆ ";
SetPos(12, 11);
cout << "☆★ ★★ ★★☆☆☆★☆☆☆☆★ ★☆";
SetPos(12, 12);
cout << "☆★ ★☆☆★ ★★☆★☆☆☆☆☆☆☆★ ★☆ ";
SetPos(12, 13);
cout << "☆★ ★☆☆☆★☆☆★★☆☆☆☆☆☆★ ★☆ ";
SetPos(12, 14);
cout << "☆★ ★☆☆☆☆☆★★☆☆☆☆☆★ ★☆";
SetPos(12, 15);
cout << "☆★ ★☆☆☆★ ★☆☆☆★ ★☆ ";
SetPos(12, 16);
cout << "☆★ ★☆★ ★ ★☆ ";
SetPos(12, 17);
cout << "☆★ ★ ★☆ ";
SetPos(12, 18);
cout << "☆★ Ich/liebe/dich制作 ★☆";
SetPos(12, 19);
cout << "☆☆★★★★★★★★★★★★★★★★★★★☆☆★★★";
Sleep(1000);
system("cls");
system("color 0F");
}
菜单界面(键盘操作)
主要思路:用户输入操作时,光标会向指定方向移动,移动后对应的值会发生改变,当用户确认操作时,对应的值会代入特定函数计算,并返回这个计算出的值,根据这个值来确认要调用哪一个函数(switch)。
/***************************
*****以下为菜单操作子模块***
*************************/
void menu_flash()
{
for (int i = 12; i <= 18; i++)
{
SetPos(42, i);
cout << " ";
}
}
/***************************
*****以下为菜单操作模块*****
**************************/
int menu_choose()
{
int j = 13;
while (1)
{
if (_kbhit())
{
char x = _getch();
switch (x)
{
case 'w':
{
if (j == 13 || j == 14 || j == 15 || j == 16 || j == 17 || j == 18 || j == 19)
{
menu_flash();
j = j - 1;
SetPos(42, j);
cout << ">>";
}
else if (j == 12 && x == 'w')
{
j = 19;
}
break;
}
case 's':
{
if (j == 11 || j == 12 || j == 13 || j == 14 || j == 15 || j == 16 || j == 17)
{
menu_flash();
j = j + 1;
SetPos(42, j);
cout << ">>";
}
else if (j == 18 && x == 's')
{
j = 11;
}
break;
}
case 'k':
{
return j - 11;
}
}
}
}
}
/***************************
*******以下为菜单界面*******
**************************/
void menu()
{
system("cls");
SetPos(43, 5);
string title = "学生成绩管理系统";
for (int i = 0; i < title.size(); i++)
{
Sleep(40);
cout << title[i];
}
SetPos(12, 7);
cout << " ______________________________________________________________________________ ";
SetPos(12, 8);
cout << "| w : 上 s : 下 k : 确认 |";
for (int i = 9; i <= 10; i++)
{
SetPos(12, i);
cout << "| |";
}
SetPos(12, 11);
cout << "| *************************************************************************** |";
SetPos(12, 12);
cout << "| ************************ 1.录入信息 ****************************** |";
SetPos(12, 13);
cout << "| ************************ 2.查看信息 ****************************** |";
SetPos(12, 14);
cout << "| ************************ 3.修改信息 ****************************** |";
SetPos(12, 15);
cout << "| ************************ 4.打印文件 ****************************** |";
SetPos(12, 16);
cout << "| ************************ 5. 搜索 ****************************** |";
SetPos(12, 17);
cout << "| ************************ 6. 主题 ****************************** |";
SetPos(12, 18);
cout << "| ************************ 7. 关于 ****************************** |";
SetPos(12, 19);
cout << "| *************************************************************************** |";
for (int i = 20; i <= 22; i++)
{
SetPos(12, i);
cout << "| |";
}
SetPos(12, 23);
cout << "  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ";
}
四,效果
打开界面时的动画
主界面
在没有初始化(录入信息)前进行操作
录入信息
查看信息
保存本地文档:
保存本地txt文档:
五,源代码
1.头文件(student.h)
#pragma once
#include <iostream>
#include <cstdlib>//exit()函数
#include <Windows.h>//光标定位
#include <fstream>//C++ I/O流
#include <string>
#include <conio.h>
using namespace std;
void SetPos(COORD a);//光标定位
void SetPos(int i, int j);
void HideCursor();//隐藏光标
void show();//展现学生信息
void input();//录入信息
void search();//查找信息
void print();//保存本地txt文件
void load();//加载动画
void modify();//修改信息
void menu_flash();//菜单子模块
int menu_choose();
void theme();//选择背景色
void menu();//主菜单
void help();//开局动画之一
2.student.cpp
#include "student.h"
struct student
{
string Number;
string Name;
string Sex;
int Clanguage;
int English;
int Math;
};
const char *txtfile = "2333.txt";//文件名
const char *datfile = "2333.dat";
student students;
ifstream a;//a和b都对dat操作
ofstream b;
ofstream d;//d对txt操作
string file;//对txt重命名
string endline = ".txt";//添加后缀
int ct = 1;//指针位置+1
void SetPos(COORD a)// set cursor
{
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(out, a);
}
void SetPos(int i, int j)// set cursor
{
COORD pos = { i, j };
SetPos(pos);
}
void show()//打开dat文件并输出到界面上
{
system("cls");
ct = 1;
a.open(datfile, ios_base::binary | ios_base::in);
if (a.is_open())
{
cout << "\t\t\t学生信息表:\n\n";
cout << "序号\t学号\t\t姓名\t性别\tC++\t英语\t高等数学" << endl;
while (a.read((char *)&students, sizeof students))
{
cout << ct++ << "\t\t"
<< students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t"
<< students.English << "\t"
<< students.Math << endl;
}
a.close();
}
else
{
cout << "\a信息加载失败!请初始化后重试!";
}
}
/***************************
*****输出为录入信息模块*****
*************************/
void input()
{
system("cls");
b.open(datfile, ios_base::binary | ios_base::out | ios_base::app);
if (!b.is_open())
{
cout << "\a文件打开失败,请稍后重试." << endl;
exit(EXIT_FAILURE);
}
int c = 1;
cout << "格式:\t";
cout << "学号\t\t姓名\t性别\t\tC++成绩\t\t英语成绩\t\t高等数学" << endl;
cout << " 各项信息间以空格隔开\n";
while (c)
{
cin >> students.Number;
cin >> students.Name;
cin >> students.Sex;
cin >> students.Clanguage;
cin >> students.English;
cin >> students.Math;
b.write((char *)&students, sizeof students);
cout << "0 ———— 退出 1 ———— 继续输入:";
cin >> c;
}
b.close();
}
/***************************
*****输出为搜索信息模块*****
*************************/
void search()//
{
system("cls");
int choose;
while (1)
{
a.open(datfile, ios_base::binary | ios_base::in);
cout << "0 ———— 退出 1 ———— 按姓名查找 2 ———— 按学号查找\n";
cin >> choose;
string name;
string num;
if (choose == 0)
{
a.close();
return;
}
if (choose == 1)
{
cout << "请输入查找姓名:";
cin >> name;
}
if (choose == 2)
{
cout << "请输入查找学号";
cin >> num;
}
if (a.is_open())
{
int flag = 0;//判断是否找到
cout << "学号\t姓名\t性别\tC++\t英语\t高等数学" << endl;
while (a.read((char *)&students, sizeof students))
{
if (choose == 1 && students.Name == name)
{
cout << students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t" << students.English << "\t"
<< students.Math << endl;
flag = 1;
}
if (choose == 2 && students.Number == num)
{
cout << students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t" << students.English << "\t"
<< students.Math << endl;
flag = 1;
}
}
if (flag == 0)
{
cout << "查询不到此信息!\n";
}
}
else
{
cout << "\a信息加载失败!请初始化后重试!";
}
a.close();
}
}
/***************************
*****输出为本地txt文件*****
*************************/
void print()
{
system("cls");
a.open(datfile, ios_base::binary | ios_base::in);
if (a.is_open())
{
cout << "文件名:" << txtfile << ",是否修改文件名?\n";
cout << " /\\ 0 ———— 是" << endl;
cout << " /!!\\ 1 ———— 否" << endl;
cout << "/ \\若文件夹中出现同名文件,可能将其覆盖.\n"
<< " ̄ ̄ ̄\n";
int answer;
while (1)//修改文件名
{
cin >> answer;
if (answer == 1)
{
cout << "请输入文件名 (不要加后缀):";
cin >> file;
d.open((file + endline), ios_base::out);
break;
}
else if (answer == 0)
{
d.open(txtfile, ios_base::out);
break;
}
else
{
cout << "输入错误,请重新输入!\n";
continue;
}
}
if (d.is_open())
{
d << "学号\t姓名\t性别\t\tC++\t\t英语\t\t高等数学\n";
while (a.read((char *)&students, sizeof students))
{
d << students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t\t"
<< students.Clanguage << "\t\t" << students.English << "\t\t"
<< students.Math << endl;
}
cout << "保存成功!";
cout << "您的文件名为" << (answer == 1 ? (file + endline) : txtfile);
cout << "请及时提取相关文件,以免文件失效或损坏\n";
d.close();
}
a.close();
}
else
{
cout << "\a文件载入失败,请稍后重试.\n";
}
}
/***************************
*****以下为界面加载动画*****
**************************/
void load()
{
system("pause");
system("cls");
SetPos(50, 14);
string LOAD = "加载中";
cout << LOAD;
for (int i = 0; i < 6; i++)
{
Sleep(150);
cout << ".";
}
system("cls");
}
/***************************
*****以下为修改信息模块*****
*************************/
void modify()//修改
{
fstream a_1;
a_1.open(datfile, ios_base::in | ios_base::out | ios_base::binary);
if (a_1.is_open())
{
int point;//想修改的数字
int end = 1;
while (end)
{
show();
cout << "0 ———— 退出";
cout << "请输入对应序号:";
cin >> point;
if (point >= 1 && point <= ct - 1)
{
streampos place = (point - 1) * sizeof students;
a_1.seekg(place);
if (a_1.fail())
{
cout << "查找错误...\n";
exit(EXIT_FAILURE);
}
a_1.read((char *)&students, sizeof students);
cout << "您即将修改的信息如下:\n";
cout << point << "\t\t"
<< students.Number << "\t"
<< students.Name << "\t"
<< students.Sex << "\t"
<< students.Clanguage << "\t"
<< students.English << "\t"
<< students.Math << endl;
if (a_1.eof())
{
a_1.clear();
}
cout << "学号:________\b\b\b\b\b\b";
cin >> students.Number;
cout << "姓名:________\b\b\b\b\b\b";
cin >> students.Name;
cout << "性别:___\b\b\b";
cin >> students.Sex;
cout << "C++:___\b\b\b";
cin >> students.Clanguage;
cout << "英语:___\b\b\b";
cin >> students.English;
cout << "高等数学:___\b\b\b";
cin >> students.Math;
a_1.seekp(place);
a_1.write((char *)&students, sizeof students);
if (a_1.fail())
{
cout << "写入错误\n";
exit(EXIT_FAILURE);
}
show();
cout << "是否继续修改?\n"
<< "0 ———— 退出 1 ———— 继续";
cin >> end;
if (end == 0)
a_1.close();
system("cls");
}
else if (point == 0)
{
a_1.close();
return;
}
else
{
cout << "\a输入的数字不在有效范围" << "(" << 1 << "~" << ct - 1 << ")"
<< "内,请重新输入.\n";
system("pause");
system("cls");
}
}
}
else
{
cout << "\a无法打开" << datfile << endl;
}
}
/***************************
*****以下为菜单操作子模块***
*************************/
void menu_flash()
{
for (int i = 12; i <= 18; i++)
{
SetPos(42, i);
cout << " ";
}
}
/***************************
*****以下为菜单操作模块*****
**************************/
int menu_choose()
{
int j = 13;
while (1)
{
if (_kbhit())
{
char x = _getch();
switch (x)
{
case 'w':
{
if (j == 13 || j == 14 || j == 15 || j == 16 || j == 17 || j == 18 || j == 19)
{
menu_flash();
j = j - 1;
SetPos(42, j);
cout << ">>";
}
else if (j == 12 && x == 'w')
{
j = 19;
}
break;
}
case 's':
{
if (j == 11 || j == 12 || j == 13 || j == 14 || j == 15 || j == 16 || j == 17)
{
menu_flash();
j = j + 1;
SetPos(42, j);
cout << ">>";
}
else if (j == 18 && x == 's')
{
j = 11;
}
break;
}
case 'k':
{
return j - 11;
}
}
}
}
}
void theme()
{
system("cls");
cout << "0.退出\n1.黄色\n2.绿色\n3.典雅白\n4.经典黑(默认)\n";
cout << "请选择:";
int i;
cin >> i;
switch (i)
{
case 4:
{
cout << "经典黑";
system("color 07");//黑底白字
system("pause");
break;
}
case 3:
{
cout << "典雅白";
system("color F0");//白底黑字
system("pause");
break;
}
case 2:
{
cout << "绿色";
system("color 0A");//黑的浅绿
system("pause");
break;
}
case 1:
{
cout << "黄色";
system("color E0");//浅黄底黑字
system("pause");
break;
}
case 0:
return;
}
}
/***************************
*******以下为菜单界面*******
**************************/
void menu()
{
system("cls");
SetPos(43, 5);
string title = "学生成绩管理系统";
for (int i = 0; i < title.size(); i++)
{
Sleep(40);
cout << title[i];
}
SetPos(12, 7);
cout << " ______________________________________________________________________________ ";
SetPos(12, 8);
cout << "| w : 上 s : 下 k : 确认 |";
for (int i = 9; i <= 10; i++)
{
SetPos(12, i);
cout << "| |";
}
SetPos(12, 11);
cout << "| *************************************************************************** |";
SetPos(12, 12);
cout << "| ************************ 1.录入信息 ****************************** |";
SetPos(12, 13);
cout << "| ************************ 2.查看信息 ****************************** |";
SetPos(12, 14);
cout << "| ************************ 3.修改信息 ****************************** |";
SetPos(12, 15);
cout << "| ************************ 4.打印文件 ****************************** |";
SetPos(12, 16);
cout << "| ************************ 5. 搜索 ****************************** |";
SetPos(12, 17);
cout << "| ************************ 6. 主题 ****************************** |";
SetPos(12, 18);
cout << "| ************************ 7. 关于 ****************************** |";
SetPos(12, 19);
cout << "| *************************************************************************** |";
for (int i = 20; i <= 22; i++)
{
SetPos(12, i);
cout << "| |";
}
SetPos(12, 23);
cout << "  ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ";
}
/*****************
**开局动画之一****
****************/
void help()
{
Sleep(100);
system("cls");
system("color 0E");
SetPos(12, 7);
cout << "☆☆★★★★★★★★★★★★★★★★★★★☆☆";
SetPos(12, 8);
cout << "☆★ ★☆";
SetPos(12, 9);
cout << "☆★ ★★★ ★★★ ★☆";
SetPos(12, 10);
cout << "☆★ ★☆☆☆★☆★☆☆☆★ ★☆ ";
SetPos(12, 11);
cout << "☆★ ★★ ★★☆☆☆★☆☆☆☆★ ★☆";
SetPos(12, 12);
cout << "☆★ ★☆☆★ ★★☆★☆☆☆☆☆☆☆★ ★☆ ";
SetPos(12, 13);
cout << "☆★ ★☆☆☆★☆☆★★☆☆☆☆☆☆★ ★☆ ";
SetPos(12, 14);
cout << "☆★ ★☆☆☆☆☆★★☆☆☆☆☆★ ★☆";
SetPos(12, 15);
cout << "☆★ ★☆☆☆★ ★☆☆☆★ ★☆ ";
SetPos(12, 16);
cout << "☆★ ★☆★ ★ ★☆ ";
SetPos(12, 17);
cout << "☆★ ★ ★☆ ";
SetPos(12, 18);
cout << "☆★ Ich/liebe/dich制作 ★☆";
SetPos(12, 19);
cout << "☆☆★★★★★★★★★★★★★★★★★★★☆☆★★★";
Sleep(1000);
system("cls");
system("color 0F");
}
3.main.cpp
#include "student.h"
void main()
{
system("title 学生成绩管理系统");
cout << right;
help();
while (1)
{
load();
menu();
int k = menu_choose();
switch (k)
{
case 1:
{
input();
break;
}
{
case 2:
show();
break;
}
case 3:
{
modify();
break;
}
case 4:
{
print();
break;
}
case 5:
{
search();
break;
}
case 6:
{
theme();
break;
}
case 7:
help();
}
}
}