2还是规范

This commit is contained in:
iridiumR 2021-10-03 10:58:05 +08:00
parent a165d1bb32
commit d4ad5301b5
1 changed files with 15 additions and 12 deletions

27
ex2.cpp
View File

@ -18,18 +18,7 @@ class Vec
public:
Vec(int len)
{
LEN=len*2;
v=new int[LEN];
USED=9;
for(int i=0;i<10;i++)
v[i]=i+1;
for(int i=0;i<10;i++)
swap(i,rand()%10);
}
Vec(int len);
int get(int a);
@ -50,6 +39,20 @@ class Vec
int getused();
};
Vec::Vec(int len)
{
LEN=len*2;
v=new int[LEN];
USED=9;
for(int i=0;i<10;i++)
v[i]=i+1;
for(int i=0;i<10;i++)
swap(i,rand()%10);
}
int Vec::get(int a)
{
return v[a];