diff options
author | Boris Verkhovskiy <boris.verk@gmail.com> | 2024-04-04 04:26:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-04 04:26:14 -0700 |
commit | 4d59048f0df8441e5ad2c2c440e8d54b0e9c11b6 (patch) | |
tree | fa2dbdd40da35b3c27f928f1112ea43193a7482e /c++.html.markdown | |
parent | b38d4437120e700646a45dff68b7c4ff3f7109c0 (diff) | |
parent | 327001f58739489b41f6b1f7bbc8be900847b381 (diff) |
Merge branch 'master' into patch-2
Diffstat (limited to 'c++.html.markdown')
-rw-r--r-- | c++.html.markdown | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/c++.html.markdown b/c++.html.markdown index 6e94e03e..499eb669 100644 --- a/c++.html.markdown +++ b/c++.html.markdown @@ -1,5 +1,5 @@ --- -language: c++ +language: C++ filename: learncpp.cpp contributors: - ["Steven Basart", "https://github.com/xksteven"] @@ -158,6 +158,10 @@ namespace Second { { printf("This is Second::foo\n"); } + void bar() + { + printf("This is Second::bar\n"); + } } void foo() @@ -168,10 +172,12 @@ void foo() int main() { // Includes all symbols from namespace Second into the current scope. Note - // that simply foo() no longer works, since it is now ambiguous whether - // we're calling the foo in namespace Second or the top level. + // that while bar() works, simply using foo() no longer works, since it is + // now ambiguous whether we're calling the foo in namespace Second or the + // top level. using namespace Second; + bar(); // prints "This is Second::bar" Second::foo(); // prints "This is Second::foo" First::Nested::foo(); // prints "This is First::Nested::foo" ::foo(); // prints "This is global foo" @@ -946,7 +952,7 @@ mymap.insert(pair<char,int>('Z',26)); // To iterate map<char,int>::iterator it; for (it=mymap.begin(); it!=mymap.end(); ++it) - std::cout << it->first << "->" << it->second << std::cout; + std::cout << it->first << "->" << it->second << std::endl; // Output: // A->1 // Z->26 @@ -1196,5 +1202,6 @@ compl 4 // Performs a bitwise not Further Reading: * An up-to-date language reference can be found at [CPP Reference](http://cppreference.com/w/cpp). -* Additional resources may be found at [CPlusPlus](http://cplusplus.com). +* A tutorial for beginners or experts, covering many modern features and good practices: [LearnCpp.com](https://www.learncpp.com/) * A tutorial covering basics of language and setting up coding environment is available at [TheChernoProject - C++](https://www.youtube.com/playlist?list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb). +* Additional resources may be found at [CPlusPlus](http://cplusplus.com). |