我是菜鸟,我最近买了本c++primer,第5版

qq_35360908 2016-06-19 05:43:34
买了本C++primer,第五版。看了半天毫无头绪,请大家,大牛看过此书的人给我点介意,我是小白,大家告诉我我应该如何学习,还是再买一本零基础的,再学习第五版。
比如,第五版目录 开始
1.1编写一个简单的程序
1.11编译、运行程序
.......
可是其中没有程序源码和过程十分不解.....,书后有一个网站地址如:informit.com/title/0321714113是纯英文并且还是一个卖书的页面,没有源码....感觉被坑了.
请大神正解
...全文
4223 50 打赏 收藏 转发到动态 举报
写回复
用AI写文章
50 条回复
切换为时间正序
请发表友善的回复…
发表回复
coderGuLala 2020-03-11
  • 打赏
  • 举报
回复
/* * 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
写好三分地 2019-02-21
  • 打赏
  • 举报
回复
此时应该祭出表情包 你知道c语言之父吗 谭浩强?
123DUO 2019-02-20
  • 打赏
  • 举报
回复
觉得找教学视频看是最容易学习的,看完视频再配合买的书看
存江 2019-02-19
  • 打赏
  • 举报
回复
入门的话,用谭浩强的书效果可能更好些
  • 打赏
  • 举报
回复
引用 10 楼 罗博士的回复:
我是看C++ Primer 第4版真正学习C++的,之前也看过一些C++教材,对比以后我当时认为C++ Primer是最好的C++教材。 不过有2个问题。 第一个,我当时看C++ Primer的时候已经有一点点C语言的基础(做过项目),反正不是纯菜鸟。 第二个,C++ Primer第5版加入了新标准的内容,我觉得对初学者来说已经非常难了。 我认为,如果你对自己的逻辑思维能力有自信的话,去看看第4版。要不然就找本中文看吧。
纯菜鸟用啥语言和那本书入门
搬砖小chen 2019-01-10
  • 打赏
  • 举报
回复
我就是这本书入门的,感觉很棒啊,至少在STL那一块比看谭浩强的同学了解的稍微深刻一点 但读这本书需要强大的自制力,楼主加油 源码网上有很多的,要学会google,或者至少学会百度吧 小诀窍:面向github编程 :)
我在地球 2018-11-29
  • 打赏
  • 举报
回复
这书估计入门够呛。
gaojun1208 2018-11-21
  • 打赏
  • 举报
回复
c++ Primer是入门的书,要边看边写。
牛奶土豆 2018-11-18
  • 打赏
  • 举报
回复
C++ Primer Plus使用者,很基础全面,同时还涉及了C,对新人友好。网上看了对C++ Primer的介绍,似乎是手册大全,工具书类,属于辅助资料。
领域灬alone 2018-11-16
  • 打赏
  • 举报
回复
C++primer的定位是工具书,需要的时候翻一翻
之苒 2018-11-15
  • 打赏
  • 举报
回复
只看过C++ primer 第4版,感觉还比较适合初学者。
沈钱青 2018-11-01
  • 打赏
  • 举报
回复
我也是书买了一本双一本,都没有好好看!
flychildc 2018-11-01
  • 打赏
  • 举报
回复
最好有基础再看,我是先看的视频教程入门的C++,最近在补基础看这本书。越看越觉得这本书牛掰
JamesWu9527 2018-09-14
  • 打赏
  • 举报
回复
The C++ Programming Language (4th Edition) 最好的C++入门书 没有之一
qq_30499345 2018-07-31
  • 打赏
  • 举报
回复
我是看完基本网课之后才看的,深入学习,而且以前还有C基础
zhouqunhai 2018-07-31
  • 打赏
  • 举报
回复
这书适合看,不适合练手
qq_42836899 2018-07-31
  • 打赏
  • 举报
回复
引用 3 楼 qq423399099 的回复:
C++primer是一本好书,可以把它作为一本字典或者是进阶的书,而不是带你入门的书。

是的,是一本好书!楼主多读几次就有不同的感觉了
Mr。Lili 2018-07-27
  • 打赏
  • 举报
回复
先学点C,在看这个吧 C++ Primer 第4版
lingyb 2018-07-26
  • 打赏
  • 举报
回复
初学的话,建议看国外很多大学使用的经典教材 "C++ How To Program", 目前出到第10版了。
薛定谔之死猫 2018-07-26
  • 打赏
  • 举报
回复
感觉不太适合初学者,内容比较多,要全部记下来可能性不大,在项目实践中强化训练才行,放在案边随手拿来翻一翻比较合适
本人是用谭浩强的《C语言程序设计》的附录C++部分入门的,现在看来足够的歪门邪道
加载更多回复(30)

33,311

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 新手乐园
社区管理员
  • 新手乐园社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧