结构体(C++)

1.定义

1.1
struct Thing{
	int wei,group;
};

2.使用

2.1 直接定义变量
void test4(){	
	Thing th ;
	th.wei = 100,th.group = 1;
	cout <<"group = "<< th.group <<",wei ="<< th.wei<<"\n"; 
}
2.2在定义变量时顺带赋值
void test4(){	
	Thing th = (Thing){0,1};
	cout <<"group = "<< th.group <<",wei ="<< th.wei<<"\n"; 
}