買了本C++primer,第五版。看了半天毫無頭緒,請大家,大牛看過此書的人給我點介意,我是小白,大家告訴我我應該如何學習,還是再買一本零基礎的,再學習第五版。
比如,第五版目錄 開始
1.1撰寫一個簡單的程式
1.11編譯、運行程式
.......
可是其中沒有程式原始碼和程序十分不解.....,書后有一個網站地址如:informit.com/title/0321714113是純英文并且還是一個賣書的頁面,沒有原始碼....感覺被坑了.
請大神正解
uj5u.com熱心網友回復:
個人覺得C++ Primer不如一本清華的C++教材(好入門)+ 一本單獨的STL入門書(更全面)雖然只是看過目錄沒有發言權,但是我覺得不應該誤導初學者,浪費初學者的時間和學習信心也是有罪的。
但是經典畢竟是經典,當一本新華字典還是不錯的。
uj5u.com熱心網友回復:
根據我看的別人的評論,國外的比較好的有C++ Primer Plus、C++大學教程、C++大學自學教程,國內的清華的鄭莉版的、錢能版的也不錯。
如果想快速入門,買本200多頁的書可以達到,然后還需要一本詳細全面的。
前面3本都是7、8百頁,清華兩本都是500多頁。
uj5u.com熱心網友回復:
C++primer是一本好書,可以把它作為一本字典或者是進階的書,而不是帶你入門的書。uj5u.com熱心網友回復:
哦,原來是本字典,,,好吧,謝謝大家對我的支持,,
uj5u.com熱心網友回復:
慢慢看會懂的uj5u.com熱心網友回復:
謝謝邀請,最開始入門不是用的它,學校給定的類似 C++語言程式設計 就差不多,
uj5u.com熱心網友回復:
不要希望一遍就能看完,看不懂就先跳過uj5u.com熱心網友回復:
別稱 C++專家如入門寶典uj5u.com熱心網友回復:
計算機組成原理→DOS命令→匯編語言→C語言(不包括C++)、代碼書寫規范→資料結構、編譯原理、作業系統→計算機網路、資料庫原理、正則運算式→其它語言(包括C++)、架構……對學習編程者的忠告:
多用小腦和手,少用大腦、眼睛和嘴,會更快地學會編程!眼過千遍不如手過一遍!
書看千行不如手敲一行!
手敲千行不如單步一行!
單步源代碼千行不如單步Debug版對應匯編一行!
單步Debug版對應匯編千行不如單步Release版對應匯編一行!
不會單步Release版對應匯編?在你想單步Release版C/C++代碼片斷的前面臨時加一句DebugBreak();重建所有,然后在IDE中運行。(一般人我不告訴他!
)單步類的實體“構造”或“復制”或“作為函式引數”或“作為函式回傳值回傳”或“參加各種運算”或“退出作用域”的陳述句對應的匯編代碼幾步后,就會來到該類的“建構式”或“復制建構式”或“運算子多載”或“解構式”對應的C/C++源代碼處。
VC除錯時按Alt+8、Alt+7、Alt+6和Alt+5,打開匯編視窗、堆疊視窗、記憶體視窗和暫存器視窗看每句C對應的匯編、單步執行并觀察相應堆疊、記憶體和暫存器變化,這樣過一遍不就啥都明白了嗎。
對VC來說,所謂‘除錯時’就是編譯連接通過以后,按F10或F11鍵單步執行一步以后的時候,或者在某行按F9設了斷點后按F5執行停在該斷點處的時候。
uj5u.com熱心網友回復:
我是看C++ Primer 第4版真正學習C++的,之前也看過一些C++教材,對比以后我當時認為C++ Primer是最好的C++教材。不過有2個問題。
第一個,我當時看C++ Primer的時候已經有一點點C語言的基礎(做過專案),反正不是純菜鳥。
第二個,C++ Primer第5版加入了新標準的內容,我覺得對初學者來說已經非常難了。
我認為,如果你對自己的邏輯思維能力有自信的話,去看看第4版。要不然就找本中文看吧。
uj5u.com熱心網友回復:
你得先練習英語,下面的鏈接是在你給的鏈接的頁面中找到的:Downloads
Download the source files for GCC 4.7.0.
http://www.informit.com/content/images/9780321714114/downloads/GCC_4_7_0.zip
Download the source code files for MS Visual Studio 2012
http://www.informit.com/content/images/9780321714114/downloads/VisualStudio2012.zip
Download the source code files for GCC pre-C++ 11 compilers 2012.
http://www.informit.com/content/images/9780321714114/downloads/GCC_pre_C11.zip
Download the source code files for Microsoft pre-C++ 11 compilers.
http://www.informit.com/content/images/9780321714114/downloads/MS_pre_C11.zip
其次你得有最基本的知識:
1、能寫hello world,并且能解釋它的語法;
2、能用基本的編譯工具,gcc也好,VC也好,會用一個。
uj5u.com熱心網友回復:
挖個墳,因為想說兩句,c++primer實際上0基礎是能看懂的,只不過需要很長時間,普通人是不推薦的
c++primer這本書每個知識點講的比較細,你可能讀了很久才學會一個知識點,然后這并不夠應用
舉個例子,你去裝配一臺電腦,給你顯卡記憶體cpu主板,
一個老師用一小時時間教給你如何組裝,然后開機運行,
另一個老師用一小時給你講cpu運行原理,c++primer這本書就屬于后者
c++primer講的很細,但是不推薦給新手的理由是收益太慢,可能學一個月就沒興趣了
事實上除了學霸是不可能有人能堅持一年直接看完c++primer的,
而且還牽扯一個問題,一個知識點不用很快就忘了,當你半年學到一半的時候,3個月的知識點可能已經忘得差不多了
一般建議最好有目的性,實踐性的學習,單純學理論知識不適用很快就遺忘了。
綜上所述新手自己取舍
建議從簡單的開始學,甚至完全零基礎的推薦看視頻學習,視頻雖然效率比較慢,但是也比較容易消化吸收(通常視頻都是入門的,不會講深入或者說細節的東西的)
uj5u.com熱心網友回復:
看不懂primer,試試primer plus,還不行就譚浩強了,把書上的例子自己敲一遍,然后打斷點,看程式怎么運行的,自己再改一改程式,再看看運行的結果。其實程式說白了,就是把語法搞懂之后,你要把你的思想轉變成計算機可識別的代碼。如果覺得枯燥就找找教學視頻看看,看別人怎么寫程式的。uj5u.com熱心網友回復:
這書很好,不過可能很累腦子。因為你在用意念跑代碼。啦啦啦。適應了就好了。大牛都是用意念跑代碼。
uj5u.com熱心網友回復:
非洲IT老師沒有電腦,用粉筆畫在黑板上的Word界面教課!
uj5u.com熱心網友回復:
這書看不下去,看不懂uj5u.com熱心網友回復:
http://srgb.vicp.net/cppprimer/ 我放自己電腦上的原始碼鏡像這本書還好吧,書上印刷的只是代碼片段,完整代碼要下載原始碼
#include <string>
using std::string;
#include <iostream>
using std::cout; using std::endl;
#include <stdexcept>
using std::out_of_range;
int main()
{
try {
string s("hello world");
cout << s.substr(0, 5) << endl; // prints hello
cout << s.substr(6) << endl; // prints world
cout << s.substr(6, 11) << endl; // prints world
cout << s.substr(12) << endl; // throws out_of_range
} catch(out_of_range) {cout << "caught out_of_range" << endl; }
return 0;
}
uj5u.com熱心網友回復:

書中的示例代碼 挺不錯的,簡潔明了,知識點很突出
uj5u.com熱心網友回復:
我也是用c++ primer入門的!看這書需要耐心,書太厚太大了、uj5u.com熱心網友回復:
試試從c++ primer plus入門uj5u.com熱心網友回復:
你被坑了uj5u.com熱心網友回復:
恒心啊。我入門C++看完了高等教育出版社的教材后,就是看C++ Primer4一定要每一章都動手寫程式!
另外,如果你是在校學生,一定要把《資料結構》《計算方法》《數值分析》這類的課程和編程學習結合起來。當年這些課程我每道習題都換著方法做好幾次。用自己的鏈表做,用STL庫做,用MFC的CList做(現在不建議了,上Qt 吧)。
C++ Primer 是一本講述C++本身的書。切勿和MFC、Qt搞渾了。這些都是C++的框架庫。C++本身提供的功能比較少,但擴展性高。學好了C++Primer,再去理解其他的庫,就快多了。一開始學習,別急著做界面。
uj5u.com熱心網友回復:
可以在慕課上看視頻學習,我目前就是的!uj5u.com熱心網友回復:
我當初看不懂這個書,后來就看了。因為學C++是為了編程,寫出軟體。我后來學VB入門的,看VB的書,學會了編程是怎么一回事。
然后才回頭學習用C++寫程式的。
僅供參考。
uj5u.com熱心網友回復:
小白學習不要看這本書,寫的其實不是太好你可以去看看c11,或者更加簡單的uj5u.com熱心網友回復:
雖然Primer的意思是“啟蒙、入門”。但是C++ Primer真不是給入門讀者準備的書。建議樓主去看清華大學鄭莉編的那套教材,這才是真正給入門新手準備的。
uj5u.com熱心網友回復:
建議去傳智博客和黑馬程式員看看菜鳥學C,講的很詳細,邊看,撰寫。uj5u.com熱心網友回復:
C++primer 個人建議你只看前面7章,這些是比較基礎的東西,后面的章節你不一定能看懂uj5u.com熱心網友回復:
c++ primer是一本進階的書,不是入門用的,剛入門可以看 c++ primer plus ,C++語言基礎等基礎教材uj5u.com熱心網友回復:
可以去看視頻教程推薦網易云課堂 c++基礎入門邊看邊寫效果挺好
uj5u.com熱心網友回復:
感覺不太適合初學者,內容比較多,要全部記下來可能性不大,在專案實踐中強化訓練才行,放在案邊隨手拿來翻一翻比較合適本人是用譚浩強的《C語言程式設計》的附錄C++部分入門的,現在看來足夠的歪門邪道
uj5u.com熱心網友回復:
初學的話,建議看國外很多大學使用的經典教材 "C++ How To Program", 目前出到第10版了。uj5u.com熱心網友回復:
先學點C,在看這個吧 C++ Primer 第4版uj5u.com熱心網友回復:
是的,是一本好書!樓主多讀幾次就有不同的感覺了
uj5u.com熱心網友回復:
這書適合看,不適合練手uj5u.com熱心網友回復:
我是看完基本網課之后才看的,深入學習,而且以前還有C基礎uj5u.com熱心網友回復:
The C++ Programming Language (4th Edition) 最好的C++入門書 沒有之一
uj5u.com熱心網友回復:
我也是書買了一本雙一本,都沒有好好看!uj5u.com熱心網友回復:
最好有基礎再看,我是先看的視頻教程入門的C++,最近在補基礎看這本書。越看越覺得這本書牛掰uj5u.com熱心網友回復:
只看過C++ primer 第4版,感徑訓比較適合初學者。uj5u.com熱心網友回復:
C++primer的定位是工具書,需要的時候翻一翻uj5u.com熱心網友回復:
C++ Primer Plus使用者,很基礎全面,同時還涉及了C,對新人友好。網上看了對C++ Primer的介紹,似乎是手冊大全,工具書類,屬于輔助資料。uj5u.com熱心網友回復:
c++ Primer是入門的書,要邊看邊寫。uj5u.com熱心網友回復:
這書估計入門夠嗆。uj5u.com熱心網友回復:
我就是這本書入門的,感覺很棒啊,至少在STL那一塊比看譚浩強的同學了解的稍微深刻一點但讀這本書需要強大的自制力,樓主加油
原始碼網上有很多的,要學會google,或者至少學會百度吧
小訣竅:面向github編程 :)
uj5u.com熱心網友回復:
純菜鳥用啥語言和那本書入門
uj5u.com熱心網友回復:
入門的話,用譚浩強的書效果可能更好些uj5u.com熱心網友回復:
覺得找教學視頻看是最容易學習的,看完視頻再配合買的書看uj5u.com熱心網友回復:
此時應該祭出表情包你知道c語言之父嗎
譚浩強?
uj5u.com熱心網友回復:
/** This file contains code from "C++ Primer, Fifth Edition", by Stanley B.
* Lippman, Josee Lajoie, and Barbara E. Moo, and is covered under the
* copyright and warranty notices given in that book:
*
* "Copyright (c) 2013 by Objectwrite, Inc., Josee Lajoie, and Barbara E. Moo."
*
*
* "The authors and publisher have taken care in the preparation of this book,
* but make no expressed or implied warranty of any kind and assume no
* responsibility for errors or omissions. No liability is assumed for
* incidental or consequential damages in connection with or arising out of the
* use of the information or programs contained herein."
*
* Permission is granted for this code to be used for educational purposes in
* association with the book, given proper citation if and when posted or
* reproduced.Any commercial use of this code requires the explicit written
* permission of the publisher, Addison-Wesley Professional, a division of
* Pearson Education, Inc. Send your request for permission, stating clearly
* what code you would like to use, and in what specific way, to the following
* address:
*
* Pearson Education, Inc.
* Rights and Permissions Department
* One Lake Street
* Upper Saddle River, NJ 07458
* Fax: (201) 236-3290
*/
/* This file defines the Sales_item class used in chapter 1.
* The code used in this file will be explained in
* Chapter 7 (Classes) and Chapter 14 (Overloaded Operators)
* Readers shouldn't try to understand the code in this file
* until they have read those chapters.
*/
#ifndef SALESITEM_H
// we're here only if SALESITEM_H has not yet been defined
#define SALESITEM_H
// Definition of Sales_item class and related functions goes here
#include <iostream>
#include <string>
class Sales_item {
// these declarations are explained section 7.2.1, p. 270
// and in chapter 14, pages 557, 558, 561
friend std::istream& operator>>(std::istream&, Sales_item&);
friend std::ostream& operator<<(std::ostream&, const Sales_item&);
friend bool operator<(const Sales_item&, const Sales_item&);
friend bool
operator==(const Sales_item&, const Sales_item&);
public:
// constructors are explained in section 7.1.4, pages 262 - 265
// default constructor needed to initialize members of built-in type
Sales_item(): units_sold(0), revenue(0.0) { }
Sales_item(const std::string &book):
bookNo(book), units_sold(0), revenue(0.0) { }
Sales_item(std::istream &is) { is >> *this; }
public:
// operations on Sales_item objects
// member binary operator: left-hand operand bound to implicit this pointer
Sales_item& operator+=(const Sales_item&);
// operations on Sales_item objects
std::string isbn() const { return bookNo; }
double avg_price() const;
// private members as before
private:
std::string bookNo; // implicitly initialized to the empty string
unsigned units_sold;
double revenue;
};
// used in chapter 10
inline
bool compareIsbn(const Sales_item &lhs, const Sales_item &rhs)
{ return lhs.isbn() == rhs.isbn(); }
// nonmember binary operator: must declare a parameter for each operand
Sales_item operator+(const Sales_item&, const Sales_item&);
inline bool
operator==(const Sales_item &lhs, const Sales_item &rhs)
{
// must be made a friend of Sales_item
return lhs.units_sold == rhs.units_sold &&
lhs.revenue == rhs.revenue &&
lhs.isbn() == rhs.isbn();
}
inline bool
operator!=(const Sales_item &lhs, const Sales_item &rhs)
{
return !(lhs == rhs); // != defined in terms of operator==
}
// assumes that both objects refer to the same ISBN
Sales_item& Sales_item::operator+=(const Sales_item& rhs)
{
units_sold += rhs.units_sold;
revenue += rhs.revenue;
return *this;
}
// assumes that both objects refer to the same ISBN
Sales_item
operator+(const Sales_item& lhs, const Sales_item& rhs)
{
Sales_item ret(lhs); // copy (|lhs|) into a local object that we'll return
ret += rhs; // add in the contents of (|rhs|)
return ret; // return (|ret|) by value
}
std::istream&
operator>>(std::istream& in, Sales_item& s)
{
double price;
in >> s.bookNo >> s.units_sold >> price;
// check that the inputs succeeded
if (in)
s.revenue = s.units_sold * price;
else
s = Sales_item(); // input failed: reset object to default state
return in;
}
std::ostream&
operator<<(std::ostream& out, const Sales_item& s)
{
out << s.isbn() << " " << s.units_sold << " "
<< s.revenue << " " << s.avg_price();
return out;
}
double Sales_item::avg_price() const
{
if (units_sold)
return revenue/units_sold;
else
return 0;
}
#endif
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/117294.html
標籤:新手樂園
上一篇:求大神指點,關于大數相加……
下一篇:小白想問
