首页 > 其他 > 详细

变量定义在主函数外面

时间:2016-05-14 22:49:33      阅读:142      评论:0      收藏:0      [点我收藏+]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 变量定义在main函数外面
{
    class Program
    {
        public int a;//变量定义在外面

        struct student
        {
            public int sno;
            public string name;
            public string sex;
        }

        static void Main(string[] args)
        {
            Program pro = new Program();
            Console.Write("请输入班级人数:");
            pro.a= int.Parse(Console.ReadLine());
            double []fenshu=new double[pro.a];

            student stu=new student();//结构体初始化类,绿色的表示类


            Console.ReadLine();
        }
    }
}

 

变量定义在主函数外面

原文:http://www.cnblogs.com/fengsantianya/p/5493415.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!