vector容器初接触

#include
#include
#include

using namespace std;
class Boy{
public:
Boy();
Boy(string name);
~Boy();
string getName();
private:
string name ;

};
Boy::Boy(){

}
Boy:: Boy(string name){

this->name = name;

}

Boy::~Boy(){

}
string Boy::getName(){

return name;

}

int main(void){

vector<int> arr;
for (int i = 0; i < 20;i++){
	//尾部添加
	arr.push_back(i+1);
	//用下标输出
	cout << arr[i] << " ";
}
cout << "\n";
//.size()方法 获得容器里的个数
cout << "容器里的个数是:" << arr.size()<<"\n";

vector<Boy> boy;
Boy B("beauty");
boy.push_back(B);
cout << boy[0].getName()<< endl;
system("pause");

return 0;

}
图片

#Contact model example atom_style granular atom_modify map array boundary m m m newton off communicate single vel yes units si processors 4 4 4 region reg block -1.0 1.0 -1.0 3.0 -1.0 1.0 units box create_box 1 reg neighbor 0.008 bin neigh_modify delay 0 #Material properties required for granular pair styles fix m1 all property/global youngsModulus peratomtype 5.e6 fix m2 all property/global poissonsRatio peratomtype 0.45 fix m3 all property/global coefficientRestitution peratomtypepair 1 0.9 fix m4 all property/global coefficientFriction peratomtypepair 1 0.05 fix m5 all property/global characteristicVelocity scalar 2. #pair style pair_style gran model hertz tangential history pair_coeff * * timestep 0.0001 fix gravi all gravity 9.81 vector 0.0 -1.0 0.0 fix boiler all mesh/surface file meshes/Boiler.stl type 1 curvature_tolerant yes fix board all mesh/surface file meshes/Board.stl type 1 curvature_tolerant yes fix down all mesh/surface file meshes/Down.stl type 1 curvature_tolerant yes fix granwalls all wall/gran model hertz tangential history mesh n_meshes 3 meshes board boiler down fix inface all mesh/surface file meshes/Up.stl type 1 #particle distributions fix pts1 all particletemplate/sphere 15485863 atom_type 1 density constant 3600 radius constant 0.01 fix pdd1 all particledistribution/discrete 15485863 1 pts1 1.0 fix ins all insert/stream seed 32452843 distributiontemplate pdd1 nparticles 10000 particlerate 500 overlapcheck yes vel constant 0. -0.2 0. insertion_face inface extrude_length 0.2 #apply nve integration to all particles fix integr all nve/sphere #output settings, include total thermal energy compute rke all erotate/sphere thermo_style custom step atoms ke c_rke vol thermo 10000 thermo_modify lost ignore norm no flush yes compute_modify thermo_temp dynamic yes #insert particles fix timecheck all check/timestep/gran 1 0.01 0.01 run 1 unfix timecheck dump dmp all custom/vtk 10000 post/liggghts_run_*.vtk id type x y z ix iy iz vx vy vz fx fy fz omegax omegay omegaz radius #f_heattransfer[0] f_heatFlux[0] dump dmpstl all mesh/stl 10000 post/Outcome*.stl #run run 300000 upto fix Moveboard all move/mesh mesh board linear 0. -0.5 0. run 10000 unfix Moveboard run 100000 write_restart post/restart/liggghts.restartrun 100000 write_restart post/restart/liggghts.restart 解析此代码
最新发布
11-11
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值