c 学生管理系统11(5)
时间:2025-04-23
时间:2025-04-23
}
//查询函数
static void Inquiry()
{
//读取文件的数据付给一个字符串数组
string[] lines = File.ReadAllLines(@".\学生管理系统文件.txt", Encoding.Default);
//定义一个字符串数组保存每一行的数据
string[] arr = new string[11];
string[] xh = new string[lines.Length - 1];
string[] xm = new string[lines.Length - 1];
string[] xb = new string[lines.Length - 1];
string[] nl = new string[lines.Length - 1];
string[] dh = new string[lines.Length - 1];
string[] dz = new string[lines.Length - 1];
string[] bj = new string[lines.Length - 1];
string[] bz = new string[lines.Length - 1];
string[] yw = new string[lines.Length - 1];
string[] sx = new string[lines.Length - 1];
string[] yy = new string[lines.Length - 1];
//切串赋值
for (int i = 1; i < lines.Length; i++)
{
string str = lines[i];
arr = str.Split('\t');
xh[i - 1] = arr[0];
xm[i - 1] = arr[1];
xb[i - 1] = arr[2];
nl[i - 1] = arr[3];
dh[i - 1] = arr[4];
dz[i - 1] = arr[5];
bj[i - 1] = arr[6];
bz[i - 1] = arr[7];
yw[i - 1] = arr[8];
sx[i - 1] = arr[9];
yy[i - 1] = arr[10];
}
int ii = 0;
while (ii <= 0)
{
Console.WriteLine("按回车键继续.....");
Console.ReadLine();
Console.Clear();
Console.WriteLine("请选择以下操作1:查询学号2:查询姓名3:查询