/* (Start of program header annotation)
* Copyright and version Declaration of the program
* Copyright (c) 2011, a student from the computer College of Yantai University
* All rights reserved.
* File name: enter 10 to store the data in the array, and then perform Bubble sorting.
* Author: Lei hengxin
* Completion date: January 1, September 10, 2012
* Version No.: V1.0
* Description of tasks and Solutions
* Input description:
* Problem description:
* Program output:
* End the comment in the program Header
*/
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Text;
Namespace ConsoleApplication1_mopaopaixu
{
Class Program
{
Static void Main (string [] args)
{
Console. WriteLine ("this is a program 'input 10 numbers into the array, and then implement bubble sorted ...");
Double [] c = new double [10];
For (int number = 0; number <10; ++ number)
{
Console. Write ("Enter the number of {0}:", number + 1 );
// String s = Console. ReadLine ();
C [number] = double. Parse (Console. ReadLine ());
}
Int I, j;
Double m;
For (I = 0; I <10; ++ I)
For (j = 0; j <10-i-1; ++ j)
{
If (c [j]> c [j + 1])
{
M = c [j];
C [j] = c [j + 1];
C [j + 1] = m;
}
}
Console. Write ("10 after the number of bubbles is sorted (in the ascending order :");
Foreach (double var in c)
{
Console. Write (var); // read the elements in the string in sequence
Console. Write ("");
}
Console. ReadKey ();
}
}
}
Running result:
Experience Accumulation:
1. I am familiar with the Bubble Sorting Algorithm again.