PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : برنامه کنسول car در c#



sahar66
2015/06/04, 21:50
برای نوشتن برنامه ی کنسول ماشین به روش زیر هم میشه عمل کرد بعد از اینکه وارد بخش کنسول برنامه شدید یک کلاس کار رو باز کنید. و به شرح زیر تایپ کنید.


calss car
}
int wheel;
string name;
string color;
int syl //سیلندر
string id;

public viod setvalue(int w,string n,string c, int s,string i)
{
wheel=w;
name=n;
color=c;
syl=s;
id=i;
}
public void display()
{
Console.writeline("wheel={0}",wheel);
Console.writeline("name={0}",name );
Console.writeline("color={0}",color);
Console.writeline("syl={0}",syl);
Console.writeline("id={0}",id);
Console.writeline("-----------------------");
}
public int getwheel()
{
return wheel;
}
public string getcolor()
{
return color;
}
public void editcolor(string c)
{
color=c;
}
public void editwheel(int w)
{
wheel=w;
}
public car getfull info()
{
car t=new car ();
t.id=id;
t.name=name;
t.color=color;
t.syl=syl;
t.wheel=wheel;
}
return t;

}
void main
car c1=new car();
car c2=new car();
c1.setvalue(1."pakan",","white",4,"at2sl");
c1.setvalue(1."suzuki",","red",4,"1234");
c1.display();
c2.dispaly();
car c3=new car();
c3=c1.getfullinfo();
c3=editwheel(3);
c2=display();
Console.Read();
{
{
{






نویسنده : سحر66