From d4ad5301b55ee75c56ef06c3ac5deb996df79e69 Mon Sep 17 00:00:00 2001 From: iridiumR Date: Sun, 3 Oct 2021 10:58:05 +0800 Subject: [PATCH] =?UTF-8?q?2=E8=BF=98=E6=98=AF=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ex2.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/ex2.cpp b/ex2.cpp index df805af..ba21b2e 100644 --- a/ex2.cpp +++ b/ex2.cpp @@ -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];