C
Join ServerC#
help
arry with loops
HHercules_x_x10/22/2022
how to Check if the array is equal. Two arrays are
equal if their sizes are same, and elements with same index from both arrays are same. Display both arrays. Display if the array is equal or not equal. no one was able to answer this question any help (edited)
equal if their sizes are same, and elements with same index from both arrays are same. Display both arrays. Display if the array is equal or not equal. no one was able to answer this question any help (edited)
HHercules_x_x10/22/2022
yes its in my uni and need to do it with loop
HHercules_x_x10/22/2022
no one was able to answe it
HHercules_x_x10/22/2022
the teacher said set your own arry value
HHercules_x_x10/22/2022
array*
HHercules_x_x10/22/2022
this is the full q

HHercules_x_x10/22/2022
from the array it self
HHercules_x_x10/22/2022
like the length
HHercules_x_x10/22/2022
count
HHercules_x_x10/22/2022
so array from 0
HHercules_x_x10/22/2022
but the value in it start from 1
Mmtreit10/22/2022
Do you know how to get the length?
HHercules_x_x10/22/2022
int[,] arr = ( (1, 2, 3), (4, 5, 6 ), ( 7, 8, 9} };
HHercules_x_x10/22/2022
for example this got 2 array
HHercules_x_x10/22/2022
Right ?
HHercules_x_x10/22/2022
0 1 2
HHercules_x_x10/22/2022
yes i know
HHercules_x_x10/22/2022
this one i dont know
HHercules_x_x10/22/2022
i don’t know how to compare vvalues
Mmtreit10/22/2022
Are you actually trying to do this for multi-dimensional arrays?
HHercules_x_x10/22/2022
Maybe i can declare tow array then loop them?
HHercules_x_x10/22/2022
if(int x= 5; )
HHercules_x_x10/22/2022
wait wait let me try
HHercules_x_x10/22/2022
shit i give up
HHercules_x_x10/22/2022
oh yaaaaa
HHercules_x_x10/22/2022
yes yes
HHercules_x_x10/22/2022
let me try
HHercules_x_x10/22/2022
First i will declare toe arrays
HHercules_x_x10/22/2022
then i will do the calculation u ask me
HHercules_x_x10/22/2022
wait please
HHercules_x_x10/22/2022
but i am confused
HHercules_x_x10/22/2022
there is tow type of array
HHercules_x_x10/22/2022
which one i declare
Mmtreit10/22/2022
What do you mean exactly?
HHercules_x_x10/22/2022
type 1.....int[,] arr = new int[,]{{1,2,3},{4,5,6},{7,8,9}};
HHercules_x_x10/22/2022
type2...• int[] arr = new int[5]{ 10, 20, 30, 40, 50 };
HHercules_x_x10/22/2022
how i knows in he future if he want the first type?
HHercules_x_x10/22/2022
2d array?
Mmtreit10/22/2022
Multi-dimensional arrays are kind of special purpose - like for defining a grid or matrix.
Mmtreit10/22/2022
Most uses of arrays are the single dimensional kind.
HHercules_x_x10/22/2022
int[] arr = { 10, 20, 30, 40, 50 };
int[] arr1 = { 5, 22, 63, 70, 80 };
if(arr == arr1)
System.Console.WriteLine("they are equal");
else
{
System.Console.WriteLine("they are not equal");
}
int[] arr1 = { 5, 22, 63, 70, 80 };
if(arr == arr1)
System.Console.WriteLine("they are equal");
else
{
System.Console.WriteLine("they are not equal");
}
HHercules_x_x10/22/2022
this better

KKouhai10/22/2022
Unfortunately this way of checking array content's equality wouldn't work in c#
HHercules_x_x10/22/2022
i am using Visual Studio
HHercules_x_x10/22/2022
then how to make it work in c#
HHercules_x_x10/22/2022
ohhhh
HHercules_x_x10/22/2022
yes in this uni must Visual studio code
HHercules_x_x10/22/2022
i had long dilemma with the teacher end up his winning and my lost lol
HHercules_x_x10/22/2022
hmmm i am confused how to do thta
HHercules_x_x10/22/2022
that
HHercules_x_x10/22/2022
yes
HHercules_x_x10/22/2022
ohhhh so array cant because not specific number
HHercules_x_x10/22/2022
yes there is
HHercules_x_x10/22/2022
arr.length ?
HHercules_x_x10/22/2022
but how to cod it nicely 

HHercules_x_x10/22/2022
let me try
HHercules_x_x10/22/2022
like that?

HHercules_x_x10/22/2022
feels wrong
HHercules_x_x10/22/2022
i try this too

HHercules_x_x10/22/2022
but obviously wrong
HHercules_x_x10/22/2022
hard life

KKouhai10/22/2022
In an if statement you'll do
KKouhai10/22/2022
(expression) == (expression)
expression here can be any value or variableKKouhai10/22/2022
So the first
second expression
expression
you have isarr=arr.Length
second expression
arr1=arr1.Length
KKouhai10/22/2022
What these expressions mean
They mean assign arr.Length to arr
and assign arr1.Length to arr1
That obviously wouldn't work because
1- arr1 and arr1.Length have different types
2- the expressions can't be compared
They mean assign arr.Length to arr
and assign arr1.Length to arr1
That obviously wouldn't work because
1- arr1 and arr1.Length have different types
2- the expressions can't be compared
HHercules_x_x10/22/2022
i am just a little confused now lol
HHercules_x_x10/22/2022
then how
HHercules_x_x10/22/2022
now?

HHercules_x_x10/22/2022
it must be this Visual headache i kill u slowly program
HHercules_x_x10/22/2022

HHercules_x_x10/22/2022
if {} ?
HHercules_x_x10/22/2022
so if can be () and {}
HHercules_x_x10/22/2022
what is the difference ?
HHercules_x_x10/22/2022
i notice for loop (FOR) always ()
HHercules_x_x10/22/2022
like this

HHercules_x_x10/22/2022
ok ok noted
HHercules_x_x10/22/2022
and elements with same index from both arrays are same.
HHercules_x_x10/22/2022
what is that
HHercules_x_x10/22/2022
i don’t understand index,
HHercules_x_x10/22/2022
ohhhhh
HHercules_x_x10/22/2022
i have an idea yea
HHercules_x_x10/22/2022
so in q want me to delete.
HHercules_x_x10/22/2022
i didn’t know that
HHercules_x_x10/22/2022
the rest of the q
HHercules_x_x10/22/2022
yes i am trying
HHercules_x_x10/22/2022
is this real person ?
HHercules_x_x10/22/2022
ok following u
HHercules_x_x10/22/2022
if ?
HHercules_x_x10/22/2022
if(arr[0] ==arr1[0]); ?
HHercules_x_x10/22/2022
heheh u are amazing teacher
HHercules_x_x10/22/2022
ok
HHercules_x_x10/22/2022
ohhh yea yea
HHercules_x_x10/22/2022
then how
HHercules_x_x10/22/2022
for(int a=0; a=<5; a++)
HHercules_x_x10/22/2022
yes sooo ok
HHercules_x_x10/22/2022
for(arr[,]=0; arr[,]=>....... i can’t figure the rest
HHercules_x_x10/22/2022
nested loop ?