When I start reviewing, I thought Chapter is useless. Because the title is “Getting Start” . I thought that is useless. But I found something I miss before, so I review it and found I understand something that confused me. So every parts is useful in this book.

The first function is very simple so we don’t have to explain it anymore. But how to compile it? I don’t think the book write well in this part. I will show you how to use cmd to compile it in Windows but I don’t have a Linux PC so I can’t show how to compile it in Linux.

1.    You should install VC. I install Visual Studio 2013 so I have VC.

2.    Locate your VC. Like me, my VC is locate here C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC

3.    Right click “This PC” and click “Properties” .Advanced system settings->Advanced->Environment Variables. Find “path” in “User Variable for XXX” .If there is no “path”, create one. Also, create two variable named “include” and “lib”.

4.    Edit “path” by adding two addresses. First is where your VC/bin are. For me is “C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin”. Second is in your “Microsoft Visual Studio X.0/Common7\IDE” folder. For me is “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE”.

5.    Edit “lib” by adding two addresses. First is where your VC/lib are. For me is “C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib”. Then use search where uuid.lib are. And add the address of it. You should separate two addresses by adding “;”.

6.    Edit “include” by adding where your VC/include are. For me is C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include.

7.    OK, now you have done building your developing environment. You can use cmd to compile your program in the way the book introduces in p.5.

I/O is not defined by the language itself so we should define it by using the IO library named iostream. A stream is a sequence of characters read from or written to an IO device. But remember cin and cout is an object of type istream and ostream. This is important to remember that cin is not the same as istream and cout is not the same as ostream. We include a header by using “#include”. We will know in the following chapter that if we writer our own header, we should use #include “(your header)” (double quotes) and the standard library #include<(library)>.

endl can end the current line. However “\n” can also do that. The different between them is that endl can flush the buffer. This ensures that all the output is written to the output stream rather than staying in the memory. For me, I prefer using endl.

Namespace is useful, it can, to some degree, avoid some mistake we may make. All names defines by the standard library are in the std namespace.

For flow of control, I will discuss it in the following article.

Class, I think, is the most important part in C++. By writing a class we can define our own data structure. A class defines a type. Sometime you will see a program that the source is just a few line but has a lot of class and the class is complicate. Member function is defined in the class. We can decide what the member function when we write the class. We can use the member function by using the dot operator (“.”) . Like the main function, when we use a function, we should use a call operator, no matter if there is any arguments.

OK, that’ all. That is what the chapter 1 says. I will write something about Chapter 2 in the next blog.

C++ Primer Chapter 1的更多相关文章

  1. C++ primer chapter 12

    动态内存:之前的程序使用对象有着严格定义的生存期,会自动销毁.C++支持动态分配对象,动态分配对象的生存期和他们在哪里创建是无关的,只有当显式的被释放,这些对象才会销毁.标准库定义了智能指针对象可以自 ...

  2. C++ primer chapter 13

    拷贝 赋值 销毁 拷贝构造函数 如果一个构造函数第一个参数是自身的引用,而且任何额外参数都有默认值,则此构造函数是拷贝构造函数拷贝构造函数的第一个类型必须是引用:如果参数不是引用类型,那么调用不会成功 ...

  3. c++primer chapter one

    一个函数的定义包含四个部分:返回类型(return type),函数名(function name),一个括号包含的形参列表(parameter,允许为空)以及函数体(function body). ...

  4. c++primer chapter three

    3.1命名空间的using声明 using声明具有如下的形式:using namespace :: name; #include <iostream> using std :: cout; ...

  5. laravel code bright

    Project RootLet’s start by taking a look at the root folder structure.• app/• bootstrap/• vendor/• p ...

  6. [笔记] 《c++ primer》书店程序 Chapter 1

    书店程序是<c++ primer>中重要的实例,涉及大部分重要知识点,但代码分散阅读不便,下面按照章节顺序总结 Sales_item.h #ifndef SALESITEM_H // we ...

  7. 《C++ Primer》 chapter 15 TextQuery

    <C++ Primer>中第15章为了讲解面向对象编程,举了一个例子:设计一个小程序,能够处理查询给定word在文件中所在行的任务,并且能够处理“非”查询,“或”查询,“与”查询.例如执行 ...

  8. C++ Primer(第五版)读书笔记 & 习题解答 --- Chapter 3

    Chapter 3.1 1. using声明具有如下的形式: using namespace::name; Chapter 3.2 1. C++标准一方面对库类型所提供的操作做了规定,另一方面也对库的 ...

  9. C++ Primer(第五版)读书笔记 & 习题解答 --- Chapter 2

    Chapter 2.1 1. 数据类型决定了程序中数据和操作的意义. 2. C++定义了一套基本数据类型,其中包括算术类型和一个名为void的特殊类型.算术类型包含了字符.整型.布尔值以及浮点数.vo ...

随机推荐

  1. poj1064 二分,注意精度!

    Cable master Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35269   Accepted: 7513 Des ...

  2. Light oj 1030 概率DP

    D - Discovering Gold Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:32768 ...

  3. jquery的uploadify上传jsp+servlet

    1.准备材料:下载jquery.uploadify上传js   注意:这个上传在firefox下会出现问题如果你在项目中加了拦截器,因为session会丢失,所以你可以传参的时候带上你所需要的条件,在 ...

  4. 通过jqueryui实现邮件提示

    //js代码$(function () { var availableTags = ["@qq.com", "@gmail.com", "@126.c ...

  5. Java Load Properties 文件,定义message信息

    初始化Properties对象,load properties文件: private static final Properties MESSAGERESOURCES = new Properties ...

  6. PHP接收JSON格式的数据

    在API服务中,目前流行采用json形式来交互. 给前端调用的接口输出Json数据,这个比较简单,只需要组织好数据,用json_encode($array) 转化一下,前端就得到json格式的数据. ...

  7. linux tar使用

    Linux  tar指令简单使用 -c:创建包,-x:解压或解包(-c和-x可理解为互逆运算),-t:查看包 -f:后加处理文件,必须放在参数组合的最后一位(tar  -cf  a.tar  1.tx ...

  8. iOS开发笔记--什么时候调用layoutSubviews

    iOS开发笔记--什么时候调用layoutSubviews 分类: iOS2014-04-22 16:15 610人阅读 评论(0) 收藏 举报 今天在写程序时候遇见layoutSubviews触发时 ...

  9. ios 多线程 面试

    1 多线程是什么  同步完成多项任务,提高了资源的使用效率,从硬件.操作系统.应用软件不同的角度去看,多线程被赋予不同的内涵,对于硬件,现在市面上多数的CPU都是多核的,多核的CPU运算多线程更为出色 ...

  10. Oracle静态监听和动态监听

    一.静态注册 静态注册指实例启动时读取listener.ora配置文件,将实例和服务注册到监听程序.无论何时启动一个数据库,默认都有两条信息注册到监听器中:实例和服务.SID_LIST_LISTENE ...