Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/pezy/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacksonicy committed Jan 5, 2016
2 parents 06b16b5 + 268aebc commit 3733247
Show file tree
Hide file tree
Showing 458 changed files with 12,053 additions and 16,194 deletions.
65 changes: 65 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: true
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AlignConsecutiveAssignments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: false
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BinPackParameters: true
BinPackArguments: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
DerivePointerAlignment: false
ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: false
IndentWrappedFunctionNames: false
IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: true
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyBreakFirstLessLess: 120
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
SpacesBeforeTrailingComments: 1
Cpp11BracedListStyle: true
Standard: Cpp11
IndentWidth: 4
TabWidth: 4
UseTab: Never
BreakBeforeBraces: Stroustrup
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false
SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4
CommentPragmas: '^ IWYU pragma:'
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
SpaceBeforeParens: ControlStatements
DisableFormat: false
...
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Contributing to CppPrimer

Please ensure your pull request adheres to the following guidelines:

1. No tabs, Use only spaces, and indent **4 space** at a time.
2. No `using namespace std;`
3. Put **spaces** after each **semicolon**, around **operators**.
```cpp
for(auto i=0;i!=size;++i) // Bad
for (auto i = 0; i != size; ++i) // Good
auto epsilon=2*gamma-delta*pi; // Bad
auto epsilon = 2 * gamma - delta * pi; // Good
```
4. Put **braces** to next line in function(such as `main()`), **otherwise, End of line**.
```cpp
int main()
{
Sales_item total;
if (std::cin >> total) {
Sales_item trans;
while (std::cin >> trans) {
//...
}
}
}
```

If you intall **[ClangFormat](http://clang.llvm.org/docs/ClangFormat.html)**, You wouldn't care about the format, just run the command:
```sh
clang-format -i your-code.cpp
```

#### Tips for good commits and issues.

1. Read up on [Github Flavored Markdown](https://help.github.com/articles/github-flavored-markdown)
2. [Closing Issues via Commit Messages](https://github.com/tiimgreen/github-cheat-sheet#closing-issues-via-commit-messages) is encouraged.
34 changes: 11 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
#C++ Primer (第5版) 习题答案
##C++ Primer (5th Edition) exercise answers.
##C++ Primer 5th Answers

[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pezy/Cpp-Primer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![GitHub issues](https://img.shields.io/github/issues/pezy/CppPrimer.svg)](https://github.com/pezy/CppPrimer/issues)
[![GitHub license](https://img.shields.io/badge/license-CC0-blue.svg)](https://raw.githubusercontent.com/pezy/Cpp-Primer/master/LICENSE)
[![](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-%E8%AE%A8%E8%AE%BA%E5%8C%BA-yellowgreen.svg)](https://github.com/ReadingLab/Discussion-for-Cpp)

### Note
### Notes

- Use `-std=c++11`(optional: `-pedantic -Wall`) flag when compiling.(or you can use Visual Studio 2012+)
- If you found any bug, please [let me know](https://github.com/Mooophy/Cpp-Primer/issues/new), thanks.
- I have downloaded the headers from this book's [web site](http://www.informit.com/store/c-plus-plus-primer-9780321714114) and put them in the `include` folder.
- In order to test the program in an efficient way, I also put the test data file in the `data` folder.
- Use `GCC 4.9+`, `Clang 3.4+`, `MSVC 14+`, and [others](http://en.cppreference.com/w/cpp/compiler_support).
- Use `-std=c++11`(recommend: `-pedantic -Wall`) flag for compiling.
- Have you discovered incorrect information? [Submit](https://github.com/pezy/CppPrimer/issues/new).

### How to contribute

- Please **fork**([How?](https://help.github.com/articles/fork-a-repo)) this repository first.
- **Commit**([How?](https://help.github.com/articles/create-a-repo#commit-your-first-change)) in your own repository.
- Give me a **pull request**([How?](https://help.github.com/articles/using-pull-requests)).
- Syncing with([How?](https://help.github.com/articles/syncing-a-fork/)) the origin repository. This is very **important** because this repo updates frequently.

### Table of Contents
### Contents

- [Chapter 1. Getting Started](ch01/README.md)
- Part I: The Basics
Expand All @@ -34,16 +27,11 @@
- [Chapter 11. Associative Containers](ch11/README.md)
- [Chapter 12. Dynamic Memory](ch12/README.md)
- Part III: Tools for Class Authors
- [Chapter 13. Copy Control](ch13)
- [Chapter 14. Overloaded Operations and Conversions](ch14)
- [Chapter 13. Copy Control](ch13/README.md)
- [Chapter 14. Overloaded Operations and Conversions](ch14/README.md)
- [Chapter 15. Object-Oriented Programming](ch15)
- [Chapter 16. Templates and Generic Programming](ch16)
- Part IV: Advanced Topics
- [Chapter 17. Specialized Library Facilities](ch17)
- [Chapter 18. Tools for Large Programs](ch18)
- Chapter 19. Specialized Tools and Techniques

### If you speak Chinese

1. [PO在StackOverflow上的习题](http://book.douban.com/review/6500246/)
2. [C++ Primer issues(豆瓣讨论组)](http://www.douban.com/group/532124/)
Loading

0 comments on commit 3733247

Please sign in to comment.