Bubble sort
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Text;
Using System.Threading.Tasks;
Namespace Shuzufuxi
{
Class Program
{
static void Main (string[] args)
{
Console.WriteLine ("Please enter the number of people:");
int n = Int. Parse (Console.ReadLine ());
string[] name = new String[n+1];
string[] t = new string[n+1];
for (int i = 1; I <= n;i++)
//{
Console.Write ("Please enter the" + i + "personal name:");
Name[i] = Console.ReadLine ();
Console.Write ("Please enter his mobile number:");
T[i] = Console.ReadLine ();
Console.Write ("Input Successful! ");
Console.ReadLine ();
Console.clear ();
// }
Random ran=new random ();
int a=0;
String S=null;
for (;;)
//{
for (int j = 0;; j + +)
// {
Console.clear ();
A = ran. Next (n + 1);
Console.WriteLine (Name[a] + ":" + t[a]);
System.Threading.Thread.Sleep (100);
if (j==10)
// {
Console.WriteLine (Name[a] + ":" + t[a]);
Console.ReadLine ();
Break
// }
// }
//}
Bubble sort from large to small arrangement
int[] Shuzu = new int[] {3, 1, 8, 4, 0, 5, 6};
8134056
8314056
//
foreach (int a in Shuzu)
//{
Console.WriteLine (a);
//}
Object//base class for all classes, can accept any data type
Console.Write ("Please enter the number of people:");
int n = Int. Parse (Console.ReadLine ());
string [] name=new string[n];
double[] CJ = new Double[n];
Double sum = 0;
for (int i = 0; i < n; i++)
{
Console.clear ();
Console.Write ("Please enter" + (i + 1) + "personal name:");
Name[i] = Console.ReadLine ();
Console.Write ("Please enter section" + (i+1) + "Personal score:");
Cj[i] = double. Parse (Console.ReadLine ());
Console.WriteLine ("Input Success");
System.Threading.Thread.Sleep (300);
}
Console.clear ();
String y;
Double x = 0;
for (int j = 0; J < (N-1); j + +)
{
for (int m = 0; m < (n-j-1); m++)
{
if (Cj[m] > Cj[m+1])
{
x = Cj[m];
CJ[M] = cj[m+1];
CJ[M+1] = x;
y = name[m];
Name[m] = name[m + 1];
Name[m + 1] = y;
}
}
}
Console.WriteLine ("Grades from low to high rank order:");
foreach (double e in CJ)
//{
Console.WriteLine (e);
//}
for (int r = 0; r < N; r++)
{
Console.WriteLine (name[r]+ ":" +cj[r]);
}
for (int z = 1; z < (n-1); z++)
{
Sum + = Cj[z];
}
Console.WriteLine ("Average score:" + (sum/(n-2)));
Console.WriteLine ("Minimum score:" + cj[0]);
Console.WriteLine ("Highest score:" + cj[n-1]);
Console.ReadLine ();
}
}
}
C # 13th session