C # 13th session

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.