结构体
class Program
{
struct student
{
public int num;
public string name;
public string sex;
public one oone;
public int[] qq;
}
struct one
{
public string aa;
public int bb;
}
static void Main(string[] args)
{
////struct
////初始化结构体
//student stu = new student();
//stu.num = 1;
//stu.name = "张三";
//stu.sex = "男";
//student stu2 = new student();
//stu2.num = 2;
//stu2.name = "李四";
//stu2.sex = "女";
////stu和stu2并没有什么关系 结构体可以说是另一种数据的存储方式
////结构体内嵌套结构体
//student stu = new student();
//stu.oone.aa = "123";
//stu.oone.bb = 123456;
//stu.qq = new int[10];//不初始化也可以,但是习惯初始化一下
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 枚举类型
{
class Program
{
enum meiju
{
one=3,//不是赋值,是指向索引,3号索引是one这个常量
two=6,//6号索引是two这个常量
three,
four=two//逗号可以省略
//若一个常量等于之前的一个常量,那么就等于这个常量,这里是赋值
}
enum meiju1
{
one=1,
two=2,
three,
four=three
}
static void Main(string[] args)
{
//结构体:定义下一组变量
//枚举类型:定义下一组常量
//const int q = 5;//常量只能使用不能进行赋值
Console.ReadLine();
}
}
}