三 写出运行结果题
(1)
using System;
class Program
{
static void Main()
{
int x = 3;
Console.Write("星期:");
Console.WriteLine((Weekday)x);
Console.Write("月份:");
Console.WriteLine((夸女人漂亮的成语Month)x);
Console.Write("季节:"牛肉烧胡萝卜);
Console.WriteLine((Season)x);
}
enum Weekday
{
未知 = -1, 星期天, 星期一, 星期二, 星期三, 星期四,星期五,星期六
}
enum Month
{
一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月, 未知 = -1
enum Season
{
春, 夏 = 2, 秋 = 4, 冬 = 8
}
}
(2)
using System;
class Program
{
static void Main()
{
class1 c1 = new class1();
class1.y = 5;
c1.Output();
class1 c2 = new class1();
c2.Output();
}
}
public class class1
烂字开头的成语
关于读书的画 private static int x = 0;
public static int y = x;
public int z = y;
public void Output()
{
Console.WriteLine(class1.x);
Console.WriteLine(class1.y);
Console.WriteLine(z);
}
}
(3)
using System;
class Program
{
static 开面馆void Main()
{文员实习
IA ia = new B();
Console.WriteLine("{0} {1} {2} {4}", ia is IA, ia is IB, ia is A, ia is A, ia is B, ia is C);
}
}
public interface IA { }
public interface IB : IA { }
True True Fal True
public class A : IA { }public class B : IB { }
public class C : B, IB { }
(4)
using System;
class Program
{
static void Main(string[] args)
{
MyClass y = new MyClass();
BaClass x = y;
x.i = 100;
Console.WriteLine("{0}, {1}", x.i, y.i);
}
}
class BaClass
{
public int i;
}
100,0
class MyClass : BaClass