Hello World
This commit is contained in:
parent
929ae9001d
commit
441d7c50d9
3 changed files with 133 additions and 36 deletions
51
.obsidian/core-plugins.json
vendored
51
.obsidian/core-plugins.json
vendored
|
@ -1,20 +1,31 @@
|
|||
[
|
||||
"file-explorer",
|
||||
"global-search",
|
||||
"switcher",
|
||||
"graph",
|
||||
"backlink",
|
||||
"canvas",
|
||||
"outgoing-link",
|
||||
"tag-pane",
|
||||
"page-preview",
|
||||
"daily-notes",
|
||||
"templates",
|
||||
"note-composer",
|
||||
"command-palette",
|
||||
"editor-status",
|
||||
"bookmarks",
|
||||
"outline",
|
||||
"word-count",
|
||||
"file-recovery"
|
||||
]
|
||||
{
|
||||
"file-explorer": true,
|
||||
"global-search": true,
|
||||
"switcher": true,
|
||||
"graph": true,
|
||||
"backlink": true,
|
||||
"canvas": true,
|
||||
"outgoing-link": true,
|
||||
"tag-pane": true,
|
||||
"properties": false,
|
||||
"page-preview": true,
|
||||
"daily-notes": true,
|
||||
"templates": true,
|
||||
"note-composer": true,
|
||||
"command-palette": true,
|
||||
"slash-command": false,
|
||||
"editor-status": true,
|
||||
"bookmarks": true,
|
||||
"markdown-importer": false,
|
||||
"zk-prefixer": false,
|
||||
"random-note": false,
|
||||
"outline": true,
|
||||
"word-count": true,
|
||||
"slides": false,
|
||||
"audio-recorder": false,
|
||||
"workspaces": false,
|
||||
"file-recovery": true,
|
||||
"publish": false,
|
||||
"sync": false,
|
||||
"webviewer": false
|
||||
}
|
57
.obsidian/workspace.json
vendored
57
.obsidian/workspace.json
vendored
|
@ -13,10 +13,12 @@
|
|||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "postgres/postgres.md",
|
||||
"file": "cpp/C++.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
}
|
||||
},
|
||||
"icon": "lucide-file",
|
||||
"title": "C++"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -38,8 +40,11 @@
|
|||
"state": {
|
||||
"type": "file-explorer",
|
||||
"state": {
|
||||
"sortOrder": "alphabetical"
|
||||
}
|
||||
"sortOrder": "alphabetical",
|
||||
"autoReveal": false
|
||||
},
|
||||
"icon": "lucide-folder-closed",
|
||||
"title": "Files"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -54,7 +59,9 @@
|
|||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical"
|
||||
}
|
||||
},
|
||||
"icon": "lucide-search",
|
||||
"title": "Search"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -62,7 +69,9 @@
|
|||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "bookmarks",
|
||||
"state": {}
|
||||
"state": {},
|
||||
"icon": "lucide-bookmark",
|
||||
"title": "Bookmarks"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -85,7 +94,7 @@
|
|||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "postgres/postgres.md",
|
||||
"file": "cpp/C++.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
|
@ -93,7 +102,9 @@
|
|||
"searchQuery": "",
|
||||
"backlinkCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
},
|
||||
"icon": "links-coming-in",
|
||||
"title": "Backlinks for C++"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -102,10 +113,12 @@
|
|||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "postgres/postgres.md",
|
||||
"file": "cpp/C++.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
},
|
||||
"icon": "links-going-out",
|
||||
"title": "Outgoing links from C++"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -115,8 +128,12 @@
|
|||
"type": "tag",
|
||||
"state": {
|
||||
"sortOrder": "frequency",
|
||||
"useHierarchy": true
|
||||
}
|
||||
"useHierarchy": true,
|
||||
"showSearch": false,
|
||||
"searchQuery": ""
|
||||
},
|
||||
"icon": "lucide-tags",
|
||||
"title": "Tags"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -125,8 +142,13 @@
|
|||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "postgres/postgres.md"
|
||||
}
|
||||
"file": "cpp/C++.md",
|
||||
"followCursor": false,
|
||||
"showSearch": false,
|
||||
"searchQuery": ""
|
||||
},
|
||||
"icon": "lucide-list",
|
||||
"title": "Outline of C++"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -134,7 +156,9 @@
|
|||
"type": "leaf",
|
||||
"state": {
|
||||
"type": "git-view",
|
||||
"state": {}
|
||||
"state": {},
|
||||
"icon": "git-pull-request",
|
||||
"title": "Source Control"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -157,10 +181,11 @@
|
|||
},
|
||||
"active": "b4e153fb6dd107ad",
|
||||
"lastOpenFiles": [
|
||||
"postgres/postgres.md",
|
||||
"cpp/C++.md",
|
||||
"README.md",
|
||||
"Untitled.canvas",
|
||||
"2024-09-08.md",
|
||||
"postgres/postgres.md",
|
||||
"docker/docker-compose.md",
|
||||
"docker/docker.md"
|
||||
]
|
||||
|
|
61
cpp/C++.md
Normal file
61
cpp/C++.md
Normal file
|
@ -0,0 +1,61 @@
|
|||
## Template
|
||||
|
||||
Templates are a way to dynamically "generate" functions from a template that accept user-defined arguments. They can be used instead of overloading a function. Example:
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
// One function works for all data types. This would work
|
||||
// even for user defined types if operator '>' is overloaded
|
||||
// Type (i/d) Func Arg Arg
|
||||
template <typename T> T myMax(T x, T y)
|
||||
{
|
||||
return (x > y) ? x : y;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
// Call myMax for int
|
||||
cout << myMax<int>(3, 7) << endl;
|
||||
// call myMax for double
|
||||
cout << myMax<double>(3.0, 7.0) << endl;
|
||||
// call myMax for char
|
||||
cout << myMax<char>('g', 'e') << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Source: https://www.geeksforgeeks.org/templates-cpp/
|
||||
|
||||
## Overloading functions
|
||||
|
||||
Overloading a function is a way to make a function execute different instructions when different types of arguments are passed using the same function name.
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
void add(int a, int b)
|
||||
{
|
||||
cout << "sum = " << (a + b);
|
||||
}
|
||||
|
||||
void add(double a, double b)
|
||||
{
|
||||
cout << endl << "sum = " << (a + b);
|
||||
}
|
||||
|
||||
// Driver code
|
||||
int main()
|
||||
{
|
||||
add(10, 2);
|
||||
add(5.3, 6.2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
Source: https://www.geeksforgeeks.org/function-overloading-c/
|
Loading…
Reference in a new issue