C # Part---Two-dimensional array, split split;

Source: Internet
Author: User

Two-dimensional arrays
How to define:

int[,] array = new int[3, 4]{
{1,2,3,4},
{3,4,5,6},
{5,6,7,8}
}; 3 indicates that there are three one-dimensional arrays
4 means that there are 4 elements in each of the one-dimensional arrays.

Split () split with * * *
The split content needs to be placed in an array of type string, without having to define the length of the array

string s = Console.ReadLine ();
string[] Array = s.split ('-');
foreach (string AA in Array)
{
Console.WriteLine (AA);
}

Enter the number of classes,
Enter the number of words in each person's English score
The Chinese two highest score, mathematics two lowest score, English average score

 //Console.WriteLine ("Please enter class Number:"); //int n = Int.                Parse (Console.ReadLine ()); //double[,] Chengji = new double[n, 3]; //for (int i = 0; i < n; i++)//{                //Console.Write ("Please enter the results of the language of the student in {0}:", (i + 1)); //chengji[i, 0] = double.                Parse (Console.ReadLine ()); //Console.Write ("Please enter the score for the math of the {0} students:", (i + 1)); //chengji[i, 1] = double.                Parse (Console.ReadLine ()); //Console.Write ("Please enter the result of the student in English of {0}:", (i + 1)); //chengji[i, 2] = double.                Parse (Console.ReadLine ()); //}                //For (int j = 0; J < N-1; J + +)//{                //for (int k = j + 1; k < n; k++)//    {                //if (chengji[j, 0] < Chengji[k, 0])//        {                //Double zhong = chengji[j, 0]; //chengji[j, 0] = chengji[k, 0]; //chengji[k, 0] = Zhong; //double zhong1 = chengji[j, 1]; //chengji[j, 1] = chengji[k, 1]; //chengji[k, 1] = zhong1; //double zhong2 = chengji[j, 2]; //chengji[j, 2] = chengji[k, 2]; //chengji[k, 2] = zhong2; //        }                //    }                //}                //Console.WriteLine ("Two of the highest language scores were {0},{1}", Chengji[0, 0], chengji[1, 0]); //For (int w = 0; w < n-1; w++)//{                //for (int y = w + 1; y < n; y++)//    {                //if (chengji[w, 1] < Chengji[y, 1])//        {                //Double zhong = chengji[w, 0]; //chengji[w, 0] = chengji[y, 0]; //chengji[y, 0] = Zhong; //double zhong1 = chengji[w, 1]; //chengji[w, 1] = chengji[y, 1]; //chengji[y, 1] = zhong1; //double zhong2 = chengji[w, 2]; //chengji[w, 2] = chengji[y, 2]; //chengji[y, 2] = zhong2; //        }                //    }                //}                //Console.WriteLine ("The lowest two digits of the math score are {0},{1}", Chengji[n-1, 1], chengji[n-2, 1]); //double sum = 0; //for (int k = 0; k < n; k++)//{                //sum = sum + chengji[k, 2]; //}                //Console.WriteLine ("Average English score is: {0}", (sum/n));

Randomly enter 20 numbers into the array,
Removes the value on an even index in the array, puts it in another array, and prints it out

//random ran=new random (); //Int[]aa=new int[20]; //Int[]bb=new int[10]; //for (int i = 0; i < 20;i++)//{                //Aa[i] = ran.                Next (); //}                //foreach (int cc in AA)//{                //Console.WriteLine (CC); //}                //Console.Write ("Please press ENTER to continue.)                "); //Console.ReadLine (); //For (int j = 0; J < 10;j++)//{                //bb[j]=aa[j*2+1]; //}                //foreach (int dd in BB)//{                //Console.WriteLine (DD); //}

C # Part---Two-dimensional array, split split;

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.