From 19903ae3536255dfa2778846275267605cee9f7e Mon Sep 17 00:00:00 2001 From: Oskar Date: Sun, 18 Aug 2024 21:02:35 +0200 Subject: more exercises, one unfinished --- 4p18.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 4p18.cpp (limited to '4p18.cpp') diff --git a/4p18.cpp b/4p18.cpp new file mode 100644 index 0000000..0788e51 --- /dev/null +++ b/4p18.cpp @@ -0,0 +1,20 @@ + +/* + * + * 4.18 + * + * + */ + +int main () { + /* + auto pbeg = v.begin(); + while (pbeg != v.end() && *beg >= 0) + cout << *pbeg++ << endl; + */ + + // It would increment pbeg by 1 and then dereference and print. + // This would mean that the first element in the vector is not printed + // This would also mean dereferencing whatever is at v.end() which is not a good idea. + return 0; +} -- cgit v1.2.3