int MyMeth(int a, double b, float ) {
...
Building
Building , , . MaxOccupant ().
// , ,
// , public int MaxOccupant(int minArea) { return Area / minArea;
MaxOccupant (), minArea . , .
Building, MaxOccupant ().
/*
, , , .
*/
Using System;
class Building {
public int Floors; //
public int Area; //
public int Occupants; //
// ,
public int AreaPerPerson() {
return Area / Occupants;
}
// , ,
// , public int MaxOccupant(int minArea) { return Area / minArea;
}
}
// MaxOccupant(). class BuildingDemo { static void Main() {
Building house = new Building();
Building office = new Building();
// house, house.Occupants = 4; house.Area = 2500; house.Floors = 2;
// office, office.Occupants = 25; office.Area = 4200; office.Floors = 3;
Console.WriteLine(" , \" + " " +
300 + " . : " + house.MaxOccupant(300));
" , \" +
" " +
300 + " . : " + office.MaxOccupant(300));
}
}
.
,
300 . : 8
,
300 . : 14
, . C# . , , . .
public void MyMeth() { char a, b;
|
|
//...
if(a==b) {
Console.WriteLine(""); return;
} else {
Console.WriteLine(" "); return;
}
Console.WriteLine (" ");
}
MyMeth () , WriteLine(). , . , , .
Building , , , .
house.Occupants = 4; house.Area = 2500; house.Floors = 2;
#. , ( ). , : ^
. , , . , . .
_{_) {
//
}
^ , , , , . , public, . _- , .
, , , C# , . , bool false, . , .