pnt.xypos= X:123, Y:45 |
前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
/********************************/
/*★ struct Sample 前田 稔 ★*/
/********************************/
using System;
class console
{
public static void Main()
{
Point pnt = new Point();
pnt.x = 123;
pnt.y = 45;
Console.WriteLine("pnt.xypos= {0}",pnt.xypos());
System.Console.ReadLine();
}
}
struct Point
{
public int x;
public int y;
public string xypos()
{
return "X:" + x.ToString() + ", Y:" + y.ToString();
}
}
|
public int x;
public int y;
|
Point pnt = new Point();
pnt.x = 123;
pnt.y = 45;
Console.WriteLine("pnt.xypos= {0}",pnt.xypos());
|
![]()