Jump to content

Reverse Value of the original value of the index in array using methods

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Badi

Badi

    Newbie

  • Members
  • Pip
  • 4 posts
Giving up the values of the series of number using the array methods.
****_______:)
Here up now I'm going to perform and show the code of storing value using array methods and with its corresponding value of its index.
And in getting the values of the index of the array,then to display its original value and the reverse value of the index using a methods.

__________________________________________________________________
//declaring the array variable and its given index value

int[]number=new int [3];
int[0]=2;
int[1]=3;
int[2]=5;

//displaying the values of the index
Console.WriteLine("This are the Original Value of the Array Index: ");
for(int i=0;i<number.Lenght;i++)
{
        Console.Write(number[i]);
}

//declaring index to hold the reverseValue Method

int index;
    
        index=reverseValue(number);
Console.WriteLine("-------------------------------------------------------");
//displaying the reverse value of the array index

Console.WriteLine("This is the reverse Value of the Original Value of the array index");

for(int idx=0;idx<index.Lenght;idx++)
{
        Console.WriteLine(index[idx]);

}

//public static methods that performs the reverse event of the original values of the array index

public static int[]reverseValue(int[]myarray)
{
         int[]Origvalue=int new[3];
         int istart=0;
         int ctr=number.Lenght-1;
       

         do
        {
                 Origvalue[istart]=myarray[ctr];
                 istart++;
                 ctr--;

        }while(istart<number.Lenght-1);

        return Origvalue;
}
__________________________________________________________________

And there up Now...
:) have a nice day always and enjoy your game.
===Badi====

Edited by Jordan, 08 July 2009 - 06:29 AM.
Added Code Tags


#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Hey Badi, thanks for the post! I've added code tags and moved it to the code section, since you didn't really explain.

#3
Sinipull

Sinipull

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 386 posts
Umm, what language is this?

#4
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
Looks like C#

#5
relapse

relapse

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 476 posts
.NET for sure.