下面是我写的一个入门级别的程序,虽然有些长,但很简单!希望大家帮忙看一下!
我的问题是:我一调试,就出现这样的画面,说我有些变量没用!!!
我哪里错了,求求你们告诉我!我弄了2天了!!!!
using System;
using System.Collections.Generic;
using System.Text;
class point
{
private int pointx;
private int pointy;
public int x
{
get
{ return pointx; }
set
{
if (value < 0)
pointx = 0;
else
pointx = value;
}
}
public int y
{
get
{ return (pointy); }
set
{
if (value < 0)
pointy = 0;
else
pointy = value;
}
}
}
class line
{
private point linestart;
private point lineend;
public point start
{
get
{ return linestart; }
set
{
if (value.x < 0)
linestart.x = 0;
else
linestart.x = value.x;
if (value.y < 0)
linestart.y = 0;
else
linestart.y = value.y;
}
}
public point end
{
get
{ return lineend; }
set
{
if (value.x < 0)
lineend.x = 0;
else
lineend.x = value.x;
if (value.y < 0)
lineend.y = 0;
else
lineend.y = value.y;
}
}
}
namespace ConsoleApplication19
{
class Program
{
static void menu()
{
Console.WriteLine("<<================MENU====================>>");
Console.WriteLine("");
Console.WriteLine("[A]—line");
Console.WriteLine("[Q]—Quit");
}
static int choice()
{
int mychoice=99;
Boolean flag=false;
string echar;
while (flag != true)
{
menu();
Console.Write("ENTER YOUR CHOICE:");
echar = Console.ReadLine();
switch (echar)
{
case "a":
case "A":
flag = true;
mychoice = 1;
break;
case "Q":
case "q":
flag = true;
mychoice = 0;
break;
default:
Console.WriteLine("wrong!try it again!");
break;
}
}
return (mychoice);
}
static void Main(string[] args)
{
line tt = new line();
tt.start.x = 0;
tt.end.x = 0;
tt.start.y = 0;
tt.end.y = 0;
}
}
}