about summary refs log tree commit diff
path: root/cpptour/veccls.cc
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-02-28 17:25:57 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-02-28 17:25:57 +0700
commit67bb27e9f5beec4d8ca0a6c29f045d5f23d6f40f (patch)
treeb677228d71b638dd6e423b037311ef0913ba66e7 /cpptour/veccls.cc
parentee9b8fc921f48dc893808e1c9dbfbef321aa362c (diff)
downloadcp-67bb27e9f5beec4d8ca0a6c29f045d5f23d6f40f.tar.gz
[lang] Reorganize language learning archive
Diffstat (limited to 'cpptour/veccls.cc')
-rw-r--r--cpptour/veccls.cc32
1 files changed, 0 insertions, 32 deletions
diff --git a/cpptour/veccls.cc b/cpptour/veccls.cc
deleted file mode 100644
index 0162d23..0000000
--- a/cpptour/veccls.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <iostream>
-
-using namespace std;
-
-class Vector {
-public:
-  Vector (int s) : elem {new double[s]}, sz {s} {}  // construct a Vector
-  double& operator[] (int i) { return elem[i]; }    // random access
-  int size () { return sz; }
-private:
-  double* elem; // pointer to the elements
-  int sz;       // the number of elements
-};
-
-double
-read_and_sum (int s)
-{
-  Vector v (s);
-  for (int i = 0; i != v.size (); ++i)
-    cin >> v[i];
-
-  double sum = 0;
-  for (int i = 0; i != v.size (); ++i)
-    sum += v[i];
-  return sum;
-}
-
-int
-main ()
-{
-  cout << read_and_sum (5) << endl;
-}