From 40f06be8bce6a779e7a3f3a8aac8954c0995f2fb Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sun, 4 Aug 2024 14:40:17 +0800 Subject: [PATCH] learn operator --- .gitignore | 2 ++ day3/afternoon/operator.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 day3/afternoon/operator.cpp diff --git a/.gitignore b/.gitignore index a8b8ceb..dd155ab 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ tempCodeRunnerFile tempCodeRunnerFile.cpp +day3/afternoon/test +day3/afternoon/operator diff --git a/day3/afternoon/operator.cpp b/day3/afternoon/operator.cpp new file mode 100644 index 0000000..1bf8c95 --- /dev/null +++ b/day3/afternoon/operator.cpp @@ -0,0 +1,17 @@ +#include +using std::cout,std::cin,std::vector,std::endl; + +std::ostream& operator<<(std::ostream& os,vector &v){ + os<<"vector ["; + for(size_t i=0;i v; + v.push_back(1); + v.push_back(2); + cout<