summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-07-30 17:01:04 +0200
committerOskar <[email protected]>2024-07-30 17:01:04 +0200
commit642720852ec17b68d8d2bbad300202604c0bb63d (patch)
tree5cdb770d6a871f90a3511bd4b885b6499cffd534
parent7aac5c6dc29079971a5c964762cdb294782b14d5 (diff)
more exercises
-rw-r--r--.idea/.gitignore8
-rw-r--r--.idea/editor.xml103
-rw-r--r--.idea/misc.xml18
-rw-r--r--.idea/vcs.xml6
-rw-r--r--2p14.cpp22
-rw-r--r--2p15.cpp18
-rw-r--r--2p16-2p17.cpp28
-rw-r--r--2p18.cpp23
-rw-r--r--2p20.cpp20
-rw-r--r--2p21.cpp20
-rw-r--r--2p25.cpp27
-rw-r--r--2p30-2p31.cpp30
-rw-r--r--const-tests.cpp25
-rw-r--r--constexpr-test.cpp22
-rw-r--r--pointertest.cpp21
15 files changed, 391 insertions, 0 deletions
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/editor.xml b/.idea/editor.xml
new file mode 100644
index 0000000..855412d
--- /dev/null
+++ b/.idea/editor.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="BackendCodeEditorSettings">
+ <option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
+ <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
+ </component>
+</project> \ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..53624c9
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
+ <component name="MakefileSettings">
+ <option name="linkedExternalProjectsSettings">
+ <MakefileProjectSettings>
+ <option name="externalProjectPath" value="$PROJECT_DIR$" />
+ <option name="modules">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ </set>
+ </option>
+ <option name="version" value="2" />
+ </MakefileProjectSettings>
+ </option>
+ </component>
+ <component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
+</project> \ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="Git" />
+ </component>
+</project> \ No newline at end of file
diff --git a/2p14.cpp b/2p14.cpp
new file mode 100644
index 0000000..d3973a6
--- /dev/null
+++ b/2p14.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ * Yes, it is legal if you aren't using compilerflags like me.
+ * 2.14
+ *
+ *
+ */
+
+int main () {
+ /*
+ int i = 100;
+ int sum = 0;
+ for(int i = 0 ; i != 10 ; i++) {
+ sum += i;
+ }
+
+ std::cout << i << " " << sum << std::endl;
+ */
+ return 0;
+}
diff --git a/2p15.cpp b/2p15.cpp
new file mode 100644
index 0000000..1e13ede
--- /dev/null
+++ b/2p15.cpp
@@ -0,0 +1,18 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.15
+ *
+ *
+ */
+
+int main () {
+
+ //int ival = 1.01; // Valid
+ //int &rval1 = 1.01; // Invalid
+ //int &rval2 = ival; // Valid
+ //int &rval3; // Invalid
+ return 0;
+}
diff --git a/2p16-2p17.cpp b/2p16-2p17.cpp
new file mode 100644
index 0000000..8a7b8eb
--- /dev/null
+++ b/2p16-2p17.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.16, 2.17
+ *
+ *
+ */
+
+int main () {
+
+ int i = 0, &r1 = i;
+ double d = 0, &r2 = d;
+
+ r2 = 3.14159; // Valid
+ r2 = r1; // Invalid
+ i = r2; // Invalid
+ r1 = d; // Invalid
+ //All valid?
+ std::cout << " ";
+ int u = 0;
+ int &ru = u;
+ u = 5;
+ ru = 10;
+ std::cout << u << " " << ru << std::endl;
+ return 0;
+}
diff --git a/2p18.cpp b/2p18.cpp
new file mode 100644
index 0000000..845ac8e
--- /dev/null
+++ b/2p18.cpp
@@ -0,0 +1,23 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.18
+ *
+ *
+ */
+
+int main () {
+
+ int myval = 10;
+ int *point = nullptr;
+ std::cout << "myval: " << myval << std::endl;
+ point = &myval;
+ *point = 1000;
+ std::cout << "myval: " << myval << "\n*point: " << *point
+ << "\npoint: " << point << "\n&myval: " << &myval
+ << std::endl;
+
+ return 0;
+}
diff --git a/2p20.cpp b/2p20.cpp
new file mode 100644
index 0000000..6e85ad8
--- /dev/null
+++ b/2p20.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.20
+ *
+ *
+ */
+
+int main () {
+
+ int i = 42;
+ int *p = &i;
+ *p = *p * *p; // Same as i = i * i;
+ std::cout << "i: " << i
+ << "\n*p: " << *p << std::endl;
+
+ return 0;
+}
diff --git a/2p21.cpp b/2p21.cpp
new file mode 100644
index 0000000..746ce34
--- /dev/null
+++ b/2p21.cpp
@@ -0,0 +1,20 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.21
+ *
+ *
+ */
+
+int main () {
+
+ int i = 0;
+ //double *dp = &i; // Invalid
+ //int *ip = i; // Invalid
+ int *p = &i;
+ std::cout << i << " " << p << std::endl;
+
+ return 0;
+}
diff --git a/2p25.cpp b/2p25.cpp
new file mode 100644
index 0000000..e97dec3
--- /dev/null
+++ b/2p25.cpp
@@ -0,0 +1,27 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.25
+ *
+ *
+ */
+
+int main () {
+
+ int *p = nullptr;
+ int i = 10;
+ int &r = i;
+ // addr 10 10
+ std::cout << &p << " " << i << " " << r << std::endl;
+
+ int i2 = 11;
+ int *ip = 0; // AKA nullptr AKA NULL
+ std::cout << i2 << " " << &ip << std::endl;
+
+ int *ip2 = nullptr;
+ int ip3 = 99;
+ std::cout << ip3 << " " << &ip2 << std::endl;
+ return 0;
+}
diff --git a/2p30-2p31.cpp b/2p30-2p31.cpp
new file mode 100644
index 0000000..eecbdbd
--- /dev/null
+++ b/2p30-2p31.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.30, 2.31
+ *
+ *
+ */
+
+int main () {
+ //int i;
+ //const int v2 = 0; // top level ??
+ //int v1 = v2;
+ //int *p1 = &v1, &r1 = v1;
+ //const int *p2 = &v2, *const p3 = &i, &r2 = v2; // p2 low level
+ // p3 top level ?? and low level??
+ // r2 low level ?
+ //r1 = v2; low level
+ //p1 = p2; low level?
+ //p1 = p3; no?
+ //p2 = p1; ok?
+ //p2 = p3; ok?
+ int v1 = 2;
+ const int v2 = 0;
+ int &r = v1;
+ r = v2;
+ std::cout << r << std::endl;
+ return 0;
+}
diff --git a/const-tests.cpp b/const-tests.cpp
new file mode 100644
index 0000000..6f07b05
--- /dev/null
+++ b/const-tests.cpp
@@ -0,0 +1,25 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * Just me testing a bit
+ *
+ *
+ */
+
+int main () {
+
+ int i = 10;
+ const int *p = &i;
+ const int ci = 42;
+ const int &r = ci;
+ const int &r2 = i;
+ std::cout << *p << " " << i << std::endl;
+ std::cout << r << std::endl;
+ i = 20;
+ std::cout << *p << " " << i << std::endl;
+ i = 3443;
+ std::cout << r2 << std::endl;
+ return 0;
+}
diff --git a/constexpr-test.cpp b/constexpr-test.cpp
new file mode 100644
index 0000000..ba88142
--- /dev/null
+++ b/constexpr-test.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * A little test
+ *
+ *
+ */
+
+constexpr int get_number() {
+
+ return 999;
+}
+
+int main () {
+
+ constexpr int i = get_number();
+ std::cout << i << std::endl;
+
+ return 0;
+}
diff --git a/pointertest.cpp b/pointertest.cpp
new file mode 100644
index 0000000..2a2210d
--- /dev/null
+++ b/pointertest.cpp
@@ -0,0 +1,21 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * Description
+ *
+ *
+ */
+
+int main () {
+
+ int val = 929992;
+ int *pi = nullptr;
+ int **pi2 = nullptr;
+ pi = &val;
+ pi2 = &pi;
+ std::cout << &pi << " " << pi2 << std::endl;
+ std::cout << val << " " << *pi << " " << **pi2 << std::endl;
+ return 0;
+}