求c#的程序运算结果~using systempublic class enumtext{enum sports{football,basketball,running=4,swimming,golf};public static void main(){sports x=(sports)0;sports y=(sports)4;sports z=(sports)7;console.writeline("x={0}",x);console.writeline(
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 08:22:39
求c#的程序运算结果~using systempublic class enumtext{enum sports{football,basketball,running=4,swimming,golf};public static void main(){sports x=(sports)0;sports y=(sports)4;sports z=(sports)7;console.writeline("x={0}",x);console.writeline(
求c#的程序运算结果~
using system
public class enumtext
{
enum sports
{football,basketball,running=4,swimming,golf};
public static void main()
{
sports x=(sports)0;
sports y=(sports)4;
sports z=(sports)7;
console.writeline("x={0}",x);
console.writeline("y={0}",y);
console.writeline("z={0}",z);
}}
求c#的程序运算结果~using systempublic class enumtext{enum sports{football,basketball,running=4,swimming,golf};public static void main(){sports x=(sports)0;sports y=(sports)4;sports z=(sports)7;console.writeline("x={0}",x);console.writeline(
输出顺序是:x = football y = running z = 7
enum:枚举,若没有规定成员值,其成员的值是从0开始的.上述中football = 0,basketball = 1;
在中间规定的成员值,running=4.不会影响此成员前面的成员值,只会让此成员之后的成员的值发生变化.上述中:swimming = 5,golf = 6.