mirror of
https://github.com/DevEhChad/cpp-cheatsheet.git
synced 2025-11-08 14:01:34 +00:00
Update more typos
This commit is contained in:
14
README.md
14
README.md
@@ -233,8 +233,8 @@ x , y // evaluates x and y, returns y (seldom used)
|
|||||||
```cpp
|
```cpp
|
||||||
class T { // A new type
|
class T { // A new type
|
||||||
private: // Section accessible only to T's member functions
|
private: // Section accessible only to T's member functions
|
||||||
protected: // Also accessuble to classes derived from T
|
protected: // Also accessible to classes derived from T
|
||||||
public: // Accessuble to all
|
public: // Accessible to all
|
||||||
int x; // Member data
|
int x; // Member data
|
||||||
void f(); // Member function
|
void f(); // Member function
|
||||||
void g() {return;} // Inline member function
|
void g() {return;} // Inline member function
|
||||||
@@ -355,7 +355,7 @@ ofstream f2("filename"); // Open file for writing
|
|||||||
if (f2) f2 << x; // Write to file
|
if (f2) f2 << x; // Write to file
|
||||||
```
|
```
|
||||||
|
|
||||||
## `string` (Variable sized character `array`)
|
## `string` (Variable sized character array)
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <string> // Include string (std namespace)
|
#include <string> // Include string (std namespace)
|
||||||
@@ -393,7 +393,7 @@ vector<T> c(n, x); // c[0]..c[n-1] init to x
|
|||||||
T d[10]; vector<T> e(d, d+10); // e is initialized from d
|
T d[10]; vector<T> e(d, d+10); // e is initialized from d
|
||||||
```
|
```
|
||||||
|
|
||||||
## `deque` (Array Stack Queue)
|
## `deque` (Array stack queue)
|
||||||
|
|
||||||
`deque<T>` is like `vector<T>`, but also supports:
|
`deque<T>` is like `vector<T>`, but also supports:
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ a.push_front(x); // Puts x at a[0], shifts elements toward back
|
|||||||
a.pop_front(); // Removes a[0], shifts toward front
|
a.pop_front(); // Removes a[0], shifts toward front
|
||||||
```
|
```
|
||||||
|
|
||||||
## `utility` (Pair)
|
## `utility` (pair)
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <utility> // Include utility (std namespace)
|
#include <utility> // Include utility (std namespace)
|
||||||
@@ -412,7 +412,7 @@ a.first; // "hello"
|
|||||||
a.second; // 3
|
a.second; // 3
|
||||||
```
|
```
|
||||||
|
|
||||||
## `map` (associative array - usually implemented as red-black Trees)
|
## `map` (associative array - usually implemented as red-black trees)
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <map> // Include map (std namespace)
|
#include <map> // Include map (std namespace)
|
||||||
@@ -423,7 +423,7 @@ for (auto& p:a)
|
|||||||
a.size(); // 1
|
a.size(); // 1
|
||||||
```
|
```
|
||||||
|
|
||||||
## `algorithm` (A collection of 60 algorithms on sequences with Iterators)
|
## `algorithm` (A collection of 60 algorithms on sequences with iterators)
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <algorithm> // Include algorithm (std namespace)
|
#include <algorithm> // Include algorithm (std namespace)
|
||||||
|
|||||||
Reference in New Issue
Block a user