C# 2005

Associate
Joined
1 Apr 2011
Posts
22
Location
London
Hi all, I'm still very new to C#, and right now I have a project, where I am creating a program.

What I need to do is declare three arrays namely A1, A2, and A3 each of size k.
Assign random values to array A1.
I want to write a C# program in microsoft visual studio 2005 using arrays and function to implement the following:
A2 (0) = A1 (k), A2 (1) = A1 (k-1), and so on….

A3 (k) = A1(k) if A1(k)>A2(k),

= A2 (k) otherwise
Output all the elements of arrays A1, A2 and A3

Please if you could help me, would be much appreciated.

Many thanks

Adam
 
Hi the problem is I dont know where to start im new to c# maybe a push in the right direction would help me grasp the whole concept.

thanks for your response

Adam
 
No materials provided thats why im a bit lost on what to do and how to start. Thanks for the input very much appreciated!
 
I managed to get this, if someone could let me know if what iv done is right pls it would much help.

static void Main(string[] args)
{
const int k = 10;

int[] A1 = new int[k];
int[] A2 = new int[k];
int[] A3 = new int[k];

for (int i = 0; i < k; i++)
{
A1 = i + 1;
}

for (int i = 0; i < k; i++)
{
A2 = A1[k-1-i];
}

for (int i = 0; i < k; i++)
{
A3 = (A1 > A2) ? A1 : A2;
}

for (int i = 0; i < k; i++)
{
Console.WriteLine("A1[" + i + "] = " + A1);
Console.WriteLine("A2[" + i + "] = " + A2);
Console.WriteLine("A3[" + i + "] = " + A3);
Console.WriteLine("");
}
}
}
}
 
Back
Top Bottom