From ce6f87441ab2343f7730139f20d25b41e9dd6080 Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 16 Oct 2024 22:50:50 +0200 Subject: some exercises added here that aren't done, will do later --- 9p29.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 9p29.cpp (limited to '9p29.cpp') diff --git a/9p29.cpp b/9p29.cpp new file mode 100644 index 0000000..6a89b06 --- /dev/null +++ b/9p29.cpp @@ -0,0 +1,26 @@ +#include +#include + +/* + * + * 9.29 + * + * + */ + +int main () { + + // vec.size() == 25 + // vec.resize(100); would add 75 elements (vec.size() == 100) + // vec.resize(10); would remove 15 elements (vec.size() == 10) + std::vector vec1(25, 0); + std::vector vec2(25, 0); + std::cout << "(vec1) Original size: " << vec1.size() << std::endl; + vec1.resize(100); + std::cout << "(vec1) After resize(100): " << vec1.size() << std::endl; + std::cout << "------------------------------" << std::endl; + std::cout << "(vec2) Original size: " << vec2.size() << std::endl; + vec2.resize(10); + std::cout << "(vec2) After resize(10): " << vec2.size() << std::endl; + return 0; +} -- cgit v1.2.3