V
Vanessa
How could I change the code below for the constructor to make use out int X
and out int Y parameters?
Could someone please show me?
using System;
namespace PRL001
{
public class Locate
{
public int loc,location,x,y;
private int [, ] mat= new int [6,20];
public Locate(int Loc)
{
loc=Loc;
createMat();
}
private void createMat()
{
for(int row = 0;row<6;row++)
{
for (int col = 0; col<20;col++)
{
mat[row,col]=location++;
}
}
}
public int getX( )
{
for(int row = 0;row<6;row++)
{
for (int col = 0; col<20;col++)
{
if(mat[row,col]==loc)
{
x=row;
}
}
}
return x;
}
public int getY( )
{
for(int row = 0;row<6;row++)
{
for (int col = 0; col<20;col++)
{
if(mat[row,col]==loc)
{
y=col;
}
}
}
return y;
}
}
}
and out int Y parameters?
Could someone please show me?
using System;
namespace PRL001
{
public class Locate
{
public int loc,location,x,y;
private int [, ] mat= new int [6,20];
public Locate(int Loc)
{
loc=Loc;
createMat();
}
private void createMat()
{
for(int row = 0;row<6;row++)
{
for (int col = 0; col<20;col++)
{
mat[row,col]=location++;
}
}
}
public int getX( )
{
for(int row = 0;row<6;row++)
{
for (int col = 0; col<20;col++)
{
if(mat[row,col]==loc)
{
x=row;
}
}
}
return x;
}
public int getY( )
{
for(int row = 0;row<6;row++)
{
for (int col = 0; col<20;col++)
{
if(mat[row,col]==loc)
{
y=col;
}
}
}
return y;
}
}
}