diff options
author | Oskar <[email protected]> | 2024-10-16 22:50:50 +0200 |
---|---|---|
committer | Oskar <[email protected]> | 2024-10-16 22:50:50 +0200 |
commit | ce6f87441ab2343f7730139f20d25b41e9dd6080 (patch) | |
tree | 431dd16b72c4ab3fa947efad172a1238e538eac9 /9p29.cpp | |
parent | 1462c1a161b3e986e066da92638fc3e9813498d4 (diff) |
some exercises added here that aren't done, will do later
Diffstat (limited to '9p29.cpp')
-rw-r--r-- | 9p29.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 <iostream> +#include <vector> + +/* + * + * 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<int> vec1(25, 0); + std::vector<int> 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; +} |