diff --git a/.vscode/settings.json b/.vscode/settings.json index e74b756..71b9576 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ { "editor.detectIndentation": false, - "editor.insertSpaces": false + "editor.insertSpaces": false, } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6aef24c..b7e10d6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,3 +5,5 @@ add_executable(sqrt sqrt.cc) target_link_libraries(sqrt PRIVATE Math) add_executable(inheritance inheritance.cc) add_executable(enumerations enumerations.cc) +add_executable(namespaces namespaces.cc) +add_executable(functions functions.cc) diff --git a/src/functions.cc b/src/functions.cc new file mode 100644 index 0000000..aac8014 --- /dev/null +++ b/src/functions.cc @@ -0,0 +1,31 @@ +#include +#include + +void sus(std::string susValue, std::string& susReference) +{ + susValue = "sus?"; + susReference = "sussy?"; + + std::cout << "sus(std::string susValue, std::string& susReference) has ran" << std::endl; +} + +void print_string(std::string nameOf, std::string& string) +{ + std::cout << "The value of " << nameOf << " is " << string << std::endl; +} + +void print_sussy_strings(std::string& sus1, std::string& sus2) +{ + print_string("sus1", sus1); + print_string("sus2", sus2); +} + +int main() +{ + std::string sus1 = "this is the first sussy string"; + std::string sus2 = "this is the second sussy string"; + + print_sussy_strings(sus1, sus2); + sus(sus1, sus2); + print_sussy_strings(sus1, sus2); +} diff --git a/src/namespaces.cc b/src/namespaces.cc new file mode 100644 index 0000000..891864f --- /dev/null +++ b/src/namespaces.cc @@ -0,0 +1,15 @@ +#include + +namespace Imposter { + class Namespace { + public: + static void sussy_function() { + std::cout << "This is a sus function." << std::endl; + } + }; +} + +int main() { + Imposter::Namespace::sussy_function(); + return 0; +}