The elements of the array insert a number at the specified position

Source: Internet
Author: User

Found that Baidu is also not a problem, some people irrelevantly replying lead to learning atmosphere a mess, so write a little basic needs comrade can refer to

  Private voidButton1_Click (Objectsender, EventArgs e) {            int[] num=New int[6]; num[0] =0; num[1] =1; num[2] =2; num[3] =3; num[4] =4; stringres =string.            Empty;  for(inti =0; I < Num. Length; i++) {res+ = Num[i] +","; }             This. Label1. Text ="before inserting:"+Res; stringRes1 =string.            Empty;  for(inti =0; I < Num. Length; i++) {res+=Num[i]; if(i = =2)                {                     for(intj = Num. length-1; J >2; j--)                    {                        if(J <6) {Num[j]= Num[j-1]; }} num[2] =int. Parse ( This. TextBox1.Text);  Break; }            }             for(inti =0; I < Num. Length; i++) {res1+ = Num[i]. ToString () +","; }             This. Label2. Text ="after insertion:"+res1; }

The elements of the array insert a number at the specified position

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.