开发控制台应用程序,为铁路人员提供以下设施。 [英] Develop console application, which provides following facilities to railway officer.

查看:110
本文介绍了开发控制台应用程序,为铁路人员提供以下设施。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Develop Console Application, which provides following facilities to Railway officer.
Railway officer will be be able to add a new train and delete a train that is not booked.
Create a menu driven application with the following menus
1. Add Train: Used to as new train
2. Delete Train: Helps in deleting a train only if its not booked
3. Book Ticket: Gets the source and destination and checks if a train is available with the given
source and destination. Gives message if no train is available otherwise get the Noof Passengers
and books the ticket
4. View Train: Used to view all the trains with the given source and destination
5. View Booked Tickets: Used to view all the booked tickets
6. Edit Train details: Edit source and destination or edit name,source and destination of train.
Implement using polymorphism. Method name should be editTrain and return type should be 1
if edit is successful otherwise 0.
Following is the approach to solve the problem.
Create train class with the following properties
• Id
• Name
• Source
• Destination
Create ticket class with the following properties
• TicketNo
• NoOfPassengers
• TrainId
Create Reservation class with a list of train and a list of ticket and the following methods
1) AddTrain(ITrain train):int
Add a train to the train list in reservation class and return auto generated Id.
2) viewTrains(string source,string destination):List<ITrain>
Search trains by source and destination and return the list of the trains which match the given
criteria
3) searchTrain(string source,string destination):int
This method will check if the train is available according to the given source and destination. If
match is found it should return train Id otherwise the method should return 0.
4) BookTicket(int noOfPassengers,int trainId,out int totalPrice): int
It will get number of passengers and should create a new ticket object with the given detail. It
should calculate the total price for booking and display it on console. Assume that price will be
unique for each passenger (200 rs per head).Maintain unique ticket No for bookings.
The method is expected to return total price and ticket number
5) viewAllBookedTickets():List<ITicket>
Should display detail for all the tickets booked.No parameters expected and the method is
expected to return list of type ticket
6) deleteTrain(int trainId):int: Delete train only if there is no reservation for that train. Return 1 if
successful otherwise return 0.
Create interface IReservation,ITrain and ITicket and the classes Reservation,Train and Ticket
NOTE: Each train can hold a maximum of 200 passengers. Handle all possible exceptions





我尝试过:



i刚刚开始并涵盖了c#的基本原理...我想设计这个控制台应用程序,其中包含以下类和接口,在描述问题部分时提到...请帮我如何创建这个控制台应用程序。



What I have tried:

i just begin and cover the basic fundamental of c#...i want to design this console application with following classes and interfaces which are mention in describe the problem section...please help me how to create this console application.

推荐答案

你写过什么吗?开始写作,我们会在您遇到问题时帮助您。在此之前,请在MSDN上启动 [ ^ ]。该程序只需要几个对象,这似乎是一个家庭作业,我们不做家庭作业,这样你就可以自己学习更多。
Did you write anything? Start writing and we will help you out as you hit a problem. Until then, start at MSDN[^]. The program only requires a few objects and this seems like a homework and we don't do homeworks so that you get to learn more yourself.


我有学生历史它会帮助你使用您可以将其转换为您的问题





使用系统;



//编写一个C#程序来保存记录并对20名学生进行统计分析。每个学生的信息包含ID,姓名,性别,测验分数(每学期2个测验),中期分数,最终分数和总分。

//程序将提示用户从菜单中选择记录操作,如下所示:



// ==================== ====================================



// MENU



// =========================== =============================



// 1。添加学生记录



// 2.删除学生记录



// 3.更新学生记录< br $>


// 4.查看所有学生记录



// 5.计算所选学生的平均值分数



// 6.显示获得最高总分的学生



// 7.显示获得最低总分的学生



// 8.按ID查找学生



// 9 。按总分排序记录



//输入您的选择:1



//注意:所有学生记录存储在一组结构中





命名空间Student_History

{

班课程

{

struct学生

{

公共字符串StdNumber;

public string StdName;

public string sex;

public float Quizz1;

public float Quizz2;

public浮动分配;

公共浮动期中;

公共浮动决赛;

公共浮动总计;

};

静态无效Main(string [] args)

{



尝试

{

学生[] Std =新学生[20];

int itemcount = 0;



DisplayMenu();

int yourchoice;

string confirm;



do

{



Console.Write(输入您的选择(1-9) :);



yourchoice = int.Parse(Console.ReadLine());





开关(yourchoice)

{



案例1:添加(标准,参考商品计数);休息;

案例2:删除(Std,ref itemcount);休息;

案例3:更新(标准,项目计数);休息;

案例4:viewall(Std,itemcount);休息;

案例5:平均值(标准,项目计数);休息;

案例6:showmax(Std,itemcount);休息;

案例7:showmin(Std,itemcount);休息;

案例8:find(Std,itemcount);休息;

案例9:bubblesort(Std,itemcount);休息;



默认值:Console.WriteLine(无效);休息;



}



Console.Write(按y或Y继续:);



confirm = Console.ReadLine()。ToString();



} while(确认== y|| confirm ==Y);



}

catch(FormatException f)

{



Console.WriteLine(输入无效);

}

Console.ReadLine() ;

}



static void DisplayMenu()

{

控制台。 WriteLine(=========================================);

Console.WriteLine(MENU);

Console.WriteLine(======================= ==================);

Console.WriteLine(1.添加学生记录);

Console.WriteLin e(2.删除学生记录);

Console.WriteLine(3.更新学生记录);

Console.WriteLine(4.查看所有学生记录);

Console.WriteLine(5.计算所选学生平均分数);

Console.WriteLine(6.Show学生获得最高总分);

Console.WriteLine(7.显示获得最低总分的学生);

Console.WriteLine(8.找一名学生通过ID);

Console.WriteLine(9.Tort students by TOTAL);

}

static void Add(学生[ ] std,ref int itemcount)

{

再次:

Console.WriteLine();

控制台。写(输入学生ID:);

Std [itemcount] .StdNumber = Console.ReadLine()。ToString();

if(Search(Std,Std) [itemcount] .StdNumber,itemcount)!= -1)

{

Console.WriteLine(此ID已存在。);

goto再次;

} < br $>


Console.Write(输入学生姓名:);



Std [itemcount] .StdName = Console.ReadLine()。ToString();





Console.Write(输入学生的性别(F或M):) ;

Std [itemcount] .sex = Console.ReadLine()。ToString();





Console.Write(输入学生的Quizz1分数:);

Std [itemcount] .Quizz1 = float.Parse(Console.ReadLine());





Console.Write(输入学生的Quizz2分数:);

Std [itemcount] .Quizz2 = float.Parse(Console.ReadLine() );





Console.Write(输入学生的Assigment分数:);

Std [itemcount ] .Assigme nt = float.Parse(Console.ReadLine());





Console.Write(输入学生的中期得分:) ;

Std [itemcount] .Midterm = float.Parse(Console.ReadLine());



Console.Write(输入学生的最终得分:);

Std [itemcount] .Final = float.Parse(Console.ReadLine());



Std [ itemCount] .Total = Std [itemcount] .Quizz1 + Std [itemcount] .Quizz2 + Std [itemcount] .Assigment + Std [itemcount] .Midterm + Std [itemcount] .Final;





++ itemcount;

}

static void delete(Student [] Std,ref int itemcount)

{

string id;

int index;

if(itemcount> 0)

{

Console.Write(输入学生的ID:);

id = Console.ReadLine();

index =搜索(Std,id.ToString(),itemcount);



if((index!= -1)&&(itemcount!= 0))

{

if(index ==(itemcount - 1))

{



clean(标准,索引);

--itemcount;



Console.WriteLine(记录被删除。);

}

其他

{

for(int i = index; i< itemcount - 1; i ++)

{

Std [i] = Std [i + 1];

clean(标准,项目计数);

--itemcount;

}



}



}

else Console.WriteLine(该记录不存在。检查ID,然后重试。);





}

else Console.WriteLine(No记录删除);

}



静态无效更新(学生[] Std,int itemcount)

{

string id;

int column_index;

Console.Write(输入学生的ID:);

id = Console.ReadLine();

Console.Write(你要更新哪个字段(1-7)?:);

column_index = int .Parse(Console.ReadLine());



int index =搜索(标准,id.ToString(),itemcount);



if((index!= -1)&&(itemcount!= 0))

{

if(column_index == 1)

{

Console.Write(输入学生姓名:);



Std [index] .Std Name = Console.ReadLine()。ToString();

}



else if(column_index == 2)

{

Console.Write(输入学生的性别(F或M):);

Std [index] .sex = Console.ReadLine()。 ToString();

}

else if(column_index == 3)

{

Console.Write( 输入学生的quizz1分数:);

标准[索引] .Quizz1 = float.Parse(Console.ReadLine());

}

else if(column_index == 4)

{

Console.Write(输入学生的quizz2得分:);

Std [ index] .Quizz2 = float.Parse(Console.ReadLine());

}

else if(column_index == 5)

{

Console.Write(输入学生的分配分数:);

标准[索引] .Assigment = float.Parse(Console.ReadLine());

}

else if(column_index == 6)

{

Console.Write(输入学生的中期得分:);

Std [index] .Midterm = float.Parse(Console.ReadLine());

}

else if(column_index == 7)

{

Console.Write(输入学生的最终得分:);

Std [index] .Final = float.Parse(Console.ReadLine( ));

}

else Console.WriteLine(无效列索引);

标准[索引]。总计=标准[索引] ] .Quizz1 + Std [index] .Quizz2 + Std [index] .Assigment + Std [index] .Midterm + Std [index] .Final;





}

else Console.WriteLine(记录deos not exits。检查ID并再试一次。);



}

static void viewall(Student [] Std,int itemcount)

{



int i = 0;



Console.WriteLine({0,-5} {1,-20} {2,-5} {3,-5} {4 ,-5} {5,-5} {6,-5} {7,-5} {8,-5},0,1,2,3,4, 5,6,7,8);

Console.WriteLine({0,-5} {1,-20} {2,-5} {3 ,-5} {4,-5} {5,-5} {6,-5} {7,-5} {8,-5},ID,NAME,SEX,Q1 ,Q2,作为,Mi,Fi,TOTAL);



Console.WriteLine(====== ================================================== ==========);



while(i< itemcount)

{



if(Std [i] .StdNumber!= null)

{



Console.Write({0,-5} {1,-20} {2,-5},Std [i] .StdNumber,Std [i] .StdName,Std [i] .sex);



Console.Write({0,-5} {1,-5} {2,-5} ,Std [i] .Quizz1,Std [i] .Quizz2,Std [i] .Assigment);



Console.Write({0,-5 } {1,-5} {2,-5},Std [i] .Midterm,Std [i] .Final,Std [i] .Total);



Console.Write(\ n);

}



i = i + 1;

}



}

静态无效平均值(学生[] Std,int itemcount)

{

string id;

float avg = 0;

Console.Write(输入students'ID:);

id = Console.ReadLine();

int index =搜索(Std,id.ToString(),itemcount);

if(index!= -1 && itemcount> 0)

{

Std [index] .Total = Std [index] .Quizz1 + Std [index] .Quizz2 + Std [index] .Assigment + Std [index] ] .Midterm + Std [index] .Final;

avg = Std [index] .Total / 5;

}



Console.WriteLine(平均得分为{0}。,平均);

}

static void showmax(Student [] Std,int itemcount)

{

float max = Std [0] .Total;

int index = 0;

Console.WriteLine(itemcount);

if(itemcount> = 2)

{



for( int j = 0; j< itemcount - 1; ++ j)

if(max< Std [j + 1] .Total)

{

max =标准[j + 1]。总计;

指数= j + 1;



}

}



否则if(itemcount == 1)

{

index = 0;

max =标准[0]。总计;

}





else Console.WriteLine(找不到记录!);



if(index!= -1)Console.WriteLine(ID为的学生:{ 0}得分最高{1}。,Std [index] .StdNumber,max);





}





static void showmin(学生[] Std,int itemcount)

{



float min = Std [0]。总计;

int index = 0;

if(itemcount> = 2)

{

for(int j = 0; j< itemcount - 1; ++ j)

if(min> Std [j + 1] .Total)

{

min = Std [j + 1 ]。总计;

指数= j + 1;



}



}



否则if(itemcount == 1)

{

index = 0;

min = Std [0]。总计;

}

其他Console.WriteLine(找不到记录!);



if(index!= -1)Console.WriteLine(ID为{0}的学生得分最低{1}。,Std [index] .StdNumber,min) ;





}



static int搜索(学生[]标准,string id,int itemcount)

{

int found = -1;

for(int i = 0; i< itemcount &&发现== -1; i ++)

{



if(Std [i] .StdNumber == id)found = i;



else找到= -1;

}



返回找到;



}





静态无效清洁(学生[]标准,整数索引)

{

Std [index] .StdNumber = null;

Std [index] .StdName = null;

Std [index] .sex = null;

Std [index] .Quizz1 = 0;

Std [index] .Quizz2 = 0;

Std [index] .Assigment = 0;

Std [index] .Midterm = 0;

Std [index] .Final = 0;

Std [index] .Total = 0;

}







static void find(Student [] Std,int itemcount )

{

string id;

Console.Write(输入学生的ID:);

id = Console.ReadLine();



Console.WriteLine({ 0,-5} {1,-20} {2,-5} {3,-5} {4,-5} {5,-5} {6,-5} {7,-5} {8, -5},0,1,2,3,4,5,6,7,8);

Console.WriteLine({0,-5} {1,-20} {2,-5} {3,-5} {4,-5} {5,-5} {6,-5} {7, -5} {8,-5},ID,NAME,SEX,Q1,Q2,As,Mi,Fi,TOTAL);



Console.WriteLine(=============================== =============================);

int index =搜索(标准,id.ToString (),itemcount);

if(index!= -1)

{

Console.Write({0,-5} {1,-20} {2,-5},Std [index] .StdNumber,Std [index] .StdName,Std [index] .sex);



Console.Write({0,-5} {1,-5} {2,-5},Std [index] .Quizz1,Std [index] .Quizz2,Std [index] .Assigment); < br $>


Console.Write({0,-5} {1,-5} {2 ,-5},Std [index] .Midterm,Std [index] .Final,Std [index] .Total);

Console.WriteLine();



}

else Console.WriteLine(记录deos not exits。);



}





static void bubblesort(Student []数据集,int n)

{

int i,j;

for(i = 0;我< N; i ++)

for(j = n - 1; j> i; j--)

if(dataset [j] .Total< dataset [j - 1 ]。总计)

{

学生时间=数据集[j];

数据集[j] =数据集[j - 1];

数据集[j - 1] = temp;

}

}

}

}
I have student History it will help you by using that you can convert that into your problem


using System;

//Write a C# program to keep records and perform statistical analysis for a class of 20 students. The information of each student contains ID, Name, Sex, quizzes Scores (2 quizzes per semester), mid-term score, final score, and total score.
//The program will prompt the user to choose the operation of records from a menu as shown below:

//========================================================

// MENU

//========================================================

//1. Add student records

// 2. Delete student records

// 3. Update student records

// 4. View all student records

// 5. Calculate an average of a selected student’s scores

// 6. Show student who gets the max total score

// 7. Show student who gets the min total score

// 8. Find student by ID

//9. Sort records by total scores

// Enter your choice:1

// Note: All students records are stored in an array of structures


namespace Student_History
{
class program
{
struct Student
{
public string StdNumber;
public string StdName;
public string sex;
public float Quizz1;
public float Quizz2;
public float Assigment;
public float Midterm;
public float Final;
public float Total;
};
static void Main(string[] args)
{

try
{
Student[] Std = new Student[20];
int itemcount = 0;

DisplayMenu();
int yourchoice;
string confirm;

do
{

Console.Write("Enter your choice(1-9):");

yourchoice = int.Parse(Console.ReadLine());


switch (yourchoice)
{

case 1: Add(Std, ref itemcount); break;
case 2: delete(Std, ref itemcount); break;
case 3: update(Std, itemcount); break;
case 4: viewall(Std, itemcount); break;
case 5: average(Std, itemcount); break;
case 6: showmax(Std, itemcount); break;
case 7: showmin(Std, itemcount); break;
case 8: find(Std, itemcount); break;
case 9: bubblesort(Std, itemcount); break;

default: Console.WriteLine("invalid"); break;

}

Console.Write("Press y or Y to continue:");

confirm = Console.ReadLine().ToString();

} while (confirm == "y" || confirm == "Y");

}
catch (FormatException f)
{

Console.WriteLine("Invalid input");
}
Console.ReadLine();
}

static void DisplayMenu()
{
Console.WriteLine("========================================= ");
Console.WriteLine(" MENU ");
Console.WriteLine("========================================= ");
Console.WriteLine(" 1.Add student records");
Console.WriteLine(" 2.Delete student records");
Console.WriteLine(" 3.Update student records");
Console.WriteLine(" 4.View all student records");
Console.WriteLine(" 5.Calculate an average of a selected student's scores");
Console.WriteLine(" 6.Show student who get the max total score");
Console.WriteLine(" 7.Show student who get the min total score");
Console.WriteLine(" 8.Find a student by ID");
Console.WriteLine(" 9.Sort students by TOTAL");
}
static void Add(Student[] Std, ref int itemcount)
{
Again:
Console.WriteLine();
Console.Write("Enter Student ID:");
Std[itemcount].StdNumber = Console.ReadLine().ToString();
if (Search(Std, Std[itemcount].StdNumber, itemcount) != -1)
{
Console.WriteLine("This ID already exists.");
goto Again;
}

Console.Write("Enter student's Name:");

Std[itemcount].StdName = Console.ReadLine().ToString();


Console.Write("Enter student's Sex(F or M):");
Std[itemcount].sex = Console.ReadLine().ToString();


Console.Write("Enter student's Quizz1 score:");
Std[itemcount].Quizz1 = float.Parse(Console.ReadLine());


Console.Write("Enter student's Quizz2 score:");
Std[itemcount].Quizz2 = float.Parse(Console.ReadLine());


Console.Write("Enter student's Assigment score:");
Std[itemcount].Assigment = float.Parse(Console.ReadLine());


Console.Write("Enter student's mid term score:");
Std[itemcount].Midterm = float.Parse(Console.ReadLine());

Console.Write("Enter student's final score:");
Std[itemcount].Final = float.Parse(Console.ReadLine());

Std[itemcount].Total = Std[itemcount].Quizz1 + Std[itemcount].Quizz2 + Std[itemcount].Assigment + Std[itemcount].Midterm + Std[itemcount].Final;


++itemcount;
}
static void delete(Student[] Std, ref int itemcount)
{
string id;
int index;
if (itemcount > 0)
{
Console.Write("Enter student's ID:");
id = Console.ReadLine();
index = Search(Std, id.ToString(), itemcount);

if ((index != -1) && (itemcount != 0))
{
if (index == (itemcount - 1))
{

clean(Std, index);
--itemcount;

Console.WriteLine("The record was deleted.");
}
else
{
for (int i = index; i < itemcount - 1; i++)
{
Std[i] = Std[i + 1];
clean(Std, itemcount);
--itemcount;
}

}

}
else Console.WriteLine("The record doesn't exist. Check the ID and try again.");


}
else Console.WriteLine("No record to delete");
}

static void update(Student[] Std, int itemcount)
{
string id;
int column_index;
Console.Write("Enter student's ID:");
id = Console.ReadLine();
Console.Write("Which field you want to update(1-7)?:");
column_index = int.Parse(Console.ReadLine());

int index = Search(Std, id.ToString(), itemcount);

if ((index != -1) && (itemcount != 0))
{
if (column_index == 1)
{
Console.Write("Enter student's Name:");

Std[index].StdName = Console.ReadLine().ToString();
}

else if (column_index == 2)
{
Console.Write("Enter student's Sex(F or M):");
Std[index].sex = Console.ReadLine().ToString();
}
else if (column_index == 3)
{
Console.Write("Enter student's quizz1 score:");
Std[index].Quizz1 = float.Parse(Console.ReadLine());
}
else if (column_index == 4)
{
Console.Write("Enter student's quizz2 score:");
Std[index].Quizz2 = float.Parse(Console.ReadLine());
}
else if (column_index == 5)
{
Console.Write("Enter student's assigment score:");
Std[index].Assigment = float.Parse(Console.ReadLine());
}
else if (column_index == 6)
{
Console.Write("Enter student's mid term score:");
Std[index].Midterm = float.Parse(Console.ReadLine());
}
else if (column_index == 7)
{
Console.Write("Enter student's final score:");
Std[index].Final = float.Parse(Console.ReadLine());
}
else Console.WriteLine("Invalid column index");
Std[index].Total = Std[index].Quizz1 + Std[index].Quizz2 + Std[index].Assigment + Std[index].Midterm + Std[index].Final;


}
else Console.WriteLine("The record deosn't exits.Check the ID and try again.");

}
static void viewall(Student[] Std, int itemcount)
{

int i = 0;

Console.WriteLine("{0,-5}{1,-20}{2,-5}{3,-5}{4,-5}{5,-5}{6,-5}{7,-5}{8,-5}", "0", "1", "2", "3", "4", "5", "6", "7", "8");
Console.WriteLine("{0,-5}{1,-20}{2,-5}{3,-5}{4,-5}{5,-5}{6,-5}{7,-5}{8,-5}", "ID", "NAME", "SEX", "Q1", "Q2", "As", "Mi", "Fi", "TOTAL");

Console.WriteLine("==================================================================");

while (i < itemcount)
{

if (Std[i].StdNumber != null)
{

Console.Write("{0,-5}{1,-20}{2,-5}", Std[i].StdNumber, Std[i].StdName, Std[i].sex);

Console.Write("{0,-5}{1,-5}{2,-5}", Std[i].Quizz1, Std[i].Quizz2, Std[i].Assigment);

Console.Write("{0,-5}{1,-5}{2,-5}", Std[i].Midterm, Std[i].Final, Std[i].Total);

Console.Write("\n");
}

i = i + 1;
}

}
static void average(Student[] Std, int itemcount)
{
string id;
float avg = 0;
Console.Write("Enter students'ID:");
id = Console.ReadLine();
int index = Search(Std, id.ToString(), itemcount);
if (index != -1 && itemcount > 0)
{
Std[index].Total = Std[index].Quizz1 + Std[index].Quizz2 + Std[index].Assigment + Std[index].Midterm + Std[index].Final;
avg = Std[index].Total / 5;
}

Console.WriteLine("The average score is {0}.", avg);
}
static void showmax(Student[] Std, int itemcount)
{
float max = Std[0].Total;
int index = 0;
Console.WriteLine(itemcount);
if (itemcount >= 2)
{

for (int j = 0; j < itemcount - 1; ++j)
if (max < Std[j + 1].Total)
{
max = Std[j + 1].Total;
index = j + 1;

}
}

else if (itemcount == 1)
{
index = 0;
max = Std[0].Total;
}


else Console.WriteLine("Not record found!");

if (index != -1) Console.WriteLine("The student with ID:{0} gets the highest score {1}.", Std[index].StdNumber, max);


}


static void showmin(Student[] Std, int itemcount)
{

float min = Std[0].Total;
int index = 0;
if (itemcount >= 2)
{
for (int j = 0; j < itemcount - 1; ++j)
if (min > Std[j + 1].Total)
{
min = Std[j + 1].Total;
index = j + 1;

}

}

else if (itemcount == 1)
{
index = 0;
min = Std[0].Total;
}
else Console.WriteLine("No record found!");

if (index != -1) Console.WriteLine("The student with ID:{0} gets the lowest score {1}.", Std[index].StdNumber, min);


}

static int Search(Student[] Std, string id, int itemcount)
{
int found = -1;
for (int i = 0; i < itemcount && found == -1; i++)
{

if (Std[i].StdNumber == id) found = i;

else found = -1;
}

return found;

}


static void clean(Student[] Std, int index)
{
Std[index].StdNumber = null;
Std[index].StdName = null;
Std[index].sex = null;
Std[index].Quizz1 = 0;
Std[index].Quizz2 = 0;
Std[index].Assigment = 0;
Std[index].Midterm = 0;
Std[index].Final = 0;
Std[index].Total = 0;
}



static void find(Student[] Std, int itemcount)
{
string id;
Console.Write("Enter student's ID:");
id = Console.ReadLine();

Console.WriteLine("{0,-5}{1,-20}{2,-5}{3,-5}{4,-5}{5,-5}{6,-5}{7,-5}{8,-5}", "0", "1", "2", "3", "4", "5", "6", "7", "8");
Console.WriteLine("{0,-5}{1,-20}{2,-5}{3,-5}{4,-5}{5,-5}{6,-5}{7,-5}{8,-5}", "ID", "NAME", "SEX", "Q1", "Q2", "As", "Mi", "Fi", "TOTAL");

Console.WriteLine("============================================================");
int index = Search(Std, id.ToString(), itemcount);
if (index != -1)
{
Console.Write("{0,-5}{1,-20}{2,-5}", Std[index].StdNumber, Std[index].StdName, Std[index].sex);

Console.Write("{0,-5}{1,-5}{2,-5}", Std[index].Quizz1, Std[index].Quizz2, Std[index].Assigment);

Console.Write("{0,-5}{1,-5}{2,-5}", Std[index].Midterm, Std[index].Final, Std[index].Total);
Console.WriteLine();

}
else Console.WriteLine("The record deosn't exits.");

}


static void bubblesort(Student[] dataset, int n)
{
int i, j;
for (i = 0; i < n; i++)
for (j = n - 1; j > i; j--)
if (dataset[j].Total < dataset[j - 1].Total)
{
Student temp = dataset[j];
dataset[j] = dataset[j - 1];
dataset[j - 1] = temp;
}
}
}
}


这篇关于开发控制台应用程序,为铁路人员提供以下设施。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆