Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Location
    Renton Wa
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Help C# Return INDEX???

    ok so i had to write a method for a single dimensional array with 9 numbers both + and - and i have to write a method that returns the largest numbers index.. how would i do that???

    int [] Array={3,-7,23,12,-4,-18,28,-15,21};

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,711
    Thanks
    41
    Thanked 191 Times in 190 Posts
    Code:
            private int[] myArray = new int[] { 3, -7, 23, 12, -4, -18, 28 - 15, 21 };
    
            private void button1_Click(object sender, EventArgs e)
            {
                Array.Sort(myArray);
                richTextBox1.Text += myArray.Last();
            }
    Array Methods

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •