From 9b931cfed1551961c8bbb93b21051104c0c4c716 Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 7 Aug 2024 22:39:51 +0200 Subject: more exercises --- 3p18.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 3p18.cpp (limited to '3p18.cpp') diff --git a/3p18.cpp b/3p18.cpp new file mode 100644 index 0000000..a35ff43 --- /dev/null +++ b/3p18.cpp @@ -0,0 +1,29 @@ +#include +#include +#include "sales_data.hpp" +#include "sales_item.hpp" + +/* + * + * 3.18 + * + * + */ + +using std::string; +using std::cout; +using std::cin; +using std::cerr; +using std::clog; +using std::endl; +using std::vector; +int main () { + + vector ivec1; + vector ivec2(10); // We could initialize it with some elements + vector ivec3{42}; // We could initialize it with the first element being 42 + ivec1.push_back(42); // One way we might fix it + ivec2[0] = 42; + cout << ivec1[0] << " " << ivec2[0] << " " << ivec3[0] << endl; + return 0; +} -- cgit v1.2.3