標籤:

初學者如何上手C++?

過江蘇省VC++二級的樣子,不是計算機專業的,學習C++有什麼合適的建議?

補充:二級已經過了,沖著就業去的。


C++Primer 5th 中文版 (no Plus) + Visual Studio 2013 Community 免費


  • C++ Primer 5th

世界上最好的C++入門教材。不要買C++ Primer Plus,不是一個等級的。但是C Primer Plus是世界上最好的C入門教材。

  • (More) Effective C++

  • Effective Modern C++

  • (More) Exceptional C++

  • Exceptional C++ Style

  • Effective STL

7本E打頭的C++書,不看完是沒法寫C++程序的,寫出來也是沒法用的。

  • The C++ Programming Language 4th

  • The C++ Standard Library 2nd

兩本參考書,也要看完。如果不想看C++標準的話這兩本書就是最權威的語言參考了。

這個書單沒什麼,是非常非常非常非常基礎的書。學C++,最怕讀得太少想得太多,不多看點書,源碼都看不懂。

==============

31st Mar 2015

C++的學習曲線本來就非常陡峭,這些書能夠有效減少各種彎路,你要是願意寫代碼提升能力當然可以,本來coding就很重要。這些書也不是說看一遍就可以的,比如7E就需要經常看,看第二遍第三遍,工作再看都會有新的感悟。我大學期間看的書,比這十倍都有,代碼保持每年十萬行左右。還是那句話,別想得太多看的太少,C++不是自己想能想明白的。


不是計算機專業的快去看譚浩強,用vc++6.0,考2級必備啊,

什麼i=i+++++5,

void main()....看完了多開心


學過好幾種語言C/C++/Python/PHP/jS等,我感覺學習這些語言,如果就去看很多人推薦的大頭書固然是能夠學好,但是前提是你必須堅持看完,可是有多少人做到呢?

我推薦的做法是:

1、了解語言發展基本的特性優點缺點,例如直接google(C++)

2、找到一個質量好不錯(沒有明顯和嚴重錯誤)的牛人得博客,一篇篇看,估計也就幾十篇,一般一周差不多就可以看完,這樣基本的知識就明白了

3、搜索一些大的長的經典案例代碼研究,遇到不明白的立刻學習,查閱那些大頭書的資料

4、深入學習

5關鍵是code code code


c++ faq - The Definitive C++ Book Guide and List 這裡提到了一些,直接拷過來。

BeginnerIntroductory, no previous programming experience

  • Programming: Principles and Practice Using C++ (Bjarne Stroustrup) (updated for C++11/C++14) An introduction to programming using C++ by the creator of the language. A good read, that assumes no previous programming experience, but is not only for beginners.

Introductory, with previous programming experience

  • C++ Primer * (Stanley Lippman, Josée Lajoie, and Barbara E. Moo) (updated for C++11) Coming at 1k pages, this is a very thorough introduction into C++ that covers just about everything in the language in a very accessible format and in great detail. The fifth edition (released August 16, 2012) covers C++11. [Review]

  • A Tour of C++ (Bjarne Stroustrup) The "tour" is a quick (about 180 pages and 14 chapters) tutorial overview of all of standard C++ (language and standard library, and using C++11) at a moderately high level for people who already know C++ or at least are experienced programmers. This book is an extended version of the material that constitutes Chapters 2-5 of The C++ Programming Language, 4th edition.

  • Accelerated C++ (Andrew Koenig and Barbara Moo) This basically covers the same ground as the C++ Primer, but does so on a fourth of its space. This is largely because it does not attempt to be an introduction to programming, but an introduction to C++ for people whove previously programmed in some other language. It has a steeper learning curve, but, for those who can cope with this, it is a very compact introduction into the language. (Historically, it broke new ground by being the first beginners book to use a modern approach at teaching the language.) [Review]

  • Thinking in C++ (Bruce Eckel) Two volumes; is a tutorial style free set of intro level books. Downloads: vol 1, vol 2. Unfortunately they』re marred by a number of trivial errors (e.g. maintaining that temporaries are automatically const), with no official errata list. A partial 3


    rd

    party errata list is available at (http://www.computersciencelab.com/Eckel.htm), but it』s apparently not maintained.

* Not to be confused with C++ Primer Plus (Stephen Prata), with a significantly less favorable review.

Best practices

  • Effective C++ (Scott Meyers) This was written with the aim of being the best second book C++ programmers should read, and it succeeded. Earlier editions were aimed at programmers coming from C, the third edition changes this and targets programmers coming from languages like Java. It presents ~50 easy-to-remember rules of thumb along with their rationale in a very accessible (and enjoyable) style. For C++11 and C++14 the examples and a few issues are outdated and Effective Modern C++ should be prefered. [Review]

  • Effective Modern C++ (Scott Meyers) This is basically the new version of Effective C++, aimed at C++ programmers making the transition from C++03 to C++11 and C++14.

  • Effective STL (Scott Meyers) This aims to do the same to the part of the standard library coming from the STL what Effective C++ did to the language as a whole: It presents rules of thumb along with their rationale. [Review]

Intermediate

  • More Effective C++ (Scott Meyers) Even more rules of thumb than Effective C++. Not as important as the ones in the first book, but still good to know.

  • Exceptional C++ (Herb Sutter) Presented as a set of puzzles, this has one of the best and thorough discussions of the proper resource management and exception safety in C++ through Resource Acquisition is Initialization (RAII) in addition to in-depth coverage of a variety of other topics including the pimpl idiom, name lookup, good class design, and the C++ memory model. [Review]

  • More Exceptional C++ (Herb Sutter) Covers additional exception safety topics not covered inExceptional C++, in addition to discussion of effective object oriented programming in C++ and correct use of the STL. [Review]

  • Exceptional C++ Style (Herb Sutter) Discusses generic programming, optimization, and resource management; this book also has an excellent exposition of how to write modular code in C++ by using nonmember functions and the single responsibility principle. [Review]

  • C++ Coding Standards (Herb Sutter and Andrei Alexandrescu) "Coding standards" here doesnt mean "how many spaces should I indent my code?" This book contains 101 best practices, idioms, and common pitfalls that can help you to write correct, understandable, and efficient C++ code. [Review]

  • C++ Templates: The Complete Guide (David Vandevoorde and Nicolai M. Josuttis) This is thebook about templates as they existed before C++11. It covers everything from the very basics to some of the most advanced template metaprogramming and explains every detail of how templates work (both conceptually and at how they are implemented) and discusses many common pitfalls. Has excellent summaries of the One Definition Rule (ODR) and overload resolution in the appendices. A second edition is scheduled for 2016. [Review]

Advanced

  • Modern C++ Design (Andrei Alexandrescu) A groundbreaking book on advanced generic programming techniques. Introduces policy-based design, type lists, and fundamental generic programming idioms then explains how many useful design patterns (including small object allocators, functors, factories, visitors, and multimethods) can be implemented efficiently, modularly, and cleanly using generic programming. [Review]

  • C++ Template Metaprogramming (David Abrahams and Aleksey Gurtovoy)

  • C++ Concurrency In Action (Anthony Williams) A book covering C++11 concurrency support including the thread library, the atomics library, the C++ memory model, locks and mutexes, as well as issues of designing and debugging multithreaded applications.

  • Advanced C++ Metaprogramming (Davide Di Gennaro) A pre-C++11 manual of TMP techniques, focused more on practice than theory. There are a ton of snippets in this book, some of which are made obsolete by typetraits, but the techniques, are nonetheless useful to know. If you can put up with the quirky formatting/editing, it is easier to read than Alexandrescu, and arguably, more rewarding. For more experienced developers, there is a good chance that you may pick up something about a dark corner of C++ (a quirk) that usually only comes about through extensive experience.

Reference Style - All Levels

  • The C++ Programming Language (Bjarne Stroustrup) (updated for C++11) The classic introduction to C++ by its creator. Written to parallel the classic KR, this indeed reads very much alike it and covers just about everything from the core language to the standard library, to programming paradigms to the languages philosophy. (Thereby making the latest editions break the 1k page barrier.) [Review] The fourth edition (released on May 19, 2013) covers C++11.

  • C++ Standard Library Tutorial and Reference (Nicolai Josuttis) (updated for C++11) Theintroduction and reference for the C++ Standard Library. The second edition (released on April 9, 2012) covers C++11. [Review]

  • The C++ IO Streams and Locales (Angelika Langer and Klaus Kreft) Theres very little to say about this book except that, if you want to know anything about streams and locales, then this is the one place to find definitive answers. [Review]

C++11 References:

  • The C++ Standard (INCITS/ISO/IEC 14882-2011) This, of course, is the final arbiter of all that is or isnt C++. Be aware, however, that it is intended purely as a reference for experiencedusers willing to devote considerable time and effort to its understanding. As usual, the first release was quite expensive ($300+ US), but it has now been released in electronic form for $60US

  • Overview of the New C++ (C++11/14) (PDF only) (Scott Meyers) (updated for C++1y/C++14) These are the presentation materials (slides and some lecture notes) of a three-day training course offered by Scott Meyers, whos a highly respected author on C++. Even though the list of items is short, the quality is high.

Classics / Older

Note: Some information contained within these books may not be up-to-date or no longer considered best practice.

  • The Design and Evolution of C++ (Bjarne Stroustrup) If you want to know why the language is the way it is, this book is where you find answers. This covers everything before the standardization of C++.

  • Ruminations on C++ - (Andrew Koenig and Barbara Moo) [Review]

  • Advanced C++ Programming Styles and Idioms (James Coplien) A predecessor of the pattern movement, it describes many C++-specific "idioms". Its certainly a very good book and might still be worth a read if you can spare the time, but quite old and not up-to-date with current C++.

  • Large Scale C++ Software Design (John Lakos) Lakos explains techniques to manage very big C++ software projects. Certainly a good read, if it only was up to date. It was written long before C++98, and misses on many features (e.g. namespaces) important for large scale projects. If you need to work in a big C++ software project, you might want to read it, although you need to take more than a grain of salt with it. The first volume of a new edition isexpected in 2015.

  • Inside the C++ Object Model (Stanley Lippman) If you want to know how virtual member functions are commonly implemented and how base objects are commonly laid out in memory in a multi-inheritance scenario, and how all this affects performance, this is where you will find thorough discussions of such topics.


還可以看看網上的視頻。


寫個播放器,邊學邊寫吧


入了門就看代碼吧,又不是九十年代消息閉塞,看大部頭書雲里霧裡的擼完還是要實踐。直接github看明星項目,牆翻好,遇到不懂的google,迅速上手。


樓上說的都挺好,在看書入門後,其實最重要的還是參與實際項目,如果是學生的話,找兩個感興趣的東西去做,或者找實驗室的各種老師去打雜,一個問題個問題啃,這樣成長才快


看什麼書,起來嗨。

講真,c++的書看過一本入門的,即可先放在一邊。先上手做一兩個項目比什麼都重要。然後開始封裝一個自己的類庫。有基礎的,按c++11標準,研究下並發模型。

入手可參考:facebook folly,輔助開發用boost、poco

推薦兩本書:boost核心研發之一的《Boost程序庫開發的94個秘笈》、IBM編譯器團隊的《C++ 11新特性解析與應用》


既然已經過了,就去看c++primer吧


推薦閱讀:

路徑追蹤中菲涅爾反射錯誤的問題?
socket拋出Cant assign requested address,問題所在以及解決方法?
【for(int i=10, j=1; i=j=0; i++, j--)()】將循環幾次?
C++ 什麼時候不應該用虛函數?
c++虛函數表在運行時候是如何存在的?

TAG:C |