If we want to use cin in the standard library, we need to

std::cin

To simplify this work, we can do like this

using namespace::name;

  

* Headers should not include using Declarations

Why?

The reason is that the contents of a header are copied into the including program's text. It's likely to encounter unexpected name conflicts.

[Cpp primer] Namespace using Declarations的更多相关文章

  1. [Cpp primer] Library vector Type

    #include<vector> using std::vector; //Vector is a container. //It has a collection of same typ ...

  2. [Cpp primer] Library string Type

    In order to use string type, we need to include the following code #include<string> using std: ...

  3. [Cpp primer] range for (c++11)

    for (declaration : expression) statement; /* This statement will iterate through the elements in the ...

  4. C++primer学习笔记(一)——Chapter 3

    3.1 Namespace using Declarations 1.因为C++里有名字空间的定义,例如我们使用cin的时候必须写成std::cin,如果就用一次还是可以接受的,但是如果一直都这样,那 ...

  5. c++ namespace命名空间详解

    What is a namespace? A namespace defines an area of code in which all identifiers are guaranteed to ...

  6. C++ 名字空间namespace的使用

    A namespace is a scope.C++ provides namespaces to prevent name conflicts.A namespace is a mechanism ...

  7. 《C++ Primer》学习总结;兼论如何使用'书'这种帮助性资料

    6.25~ 6.27,用了3天翻了一遍<C++ Primer>. ▶书的 固有坏处 一句话: 代码比 文字描述 好看多了.————> 直接看习题部分/ 看demo就行了 看文字在描述 ...

  8. namespace的作用

    namespace的用法 1.什么是命名空间 通常我们学c++的时候经常看见头文件下有一句using namespace std,有什么用呢? 例如: #include<iostream> ...

  9. C++/CLI中class成员声明与实现分开在不同文件时必须添加namespace

    以下是我的代码: //TaskConfigFile.h #pragma once using namespace System::Collections::Generic; using namespa ...

随机推荐

  1. Java数据封装类

    项目中用到,比较好用!! 用户前端与后台的交互数据,这个封装类中包含分页.数据.错误码.状态码等信息!! 亲测好用哦! 一个类DataWrapper public class DataWrapper& ...

  2. SSH 首次登录太慢问题

    这两天在使用 Docker 做测试,发现新建的容器在首次 ssh 登录的时候经常超时,我们简单将超时时间设置成60秒,但仍然会偶尔超时.所以简单延迟超时时间此路不通. 于是想到是否可以通过修改 ssh ...

  3. 使用pipework将Docker容器配置到本地网络环境中

    使用pipework将Docker容器配置到本地网络环境中 需求 在使用Docker的过程中,有时候我们会有将Docker容器配置到和主机同一网段的需求.要实现这个需求,我们只要将Docker容器和主 ...

  4. vue_ form表单 v-model

    插值两种方式:{{}},v-model v-model 可以用 v-model 指令在只能在表单 <input> 及 <textarea> 元素上创建双向数据绑定.它会根据控件 ...

  5. 【pandas】pandas.Series.str.split()---字符串分割

    原创博文,转载请注明出处! 本文代码的github地址       series中的元素均为字符串时,通过str.split可将字符串按指定的分隔符拆分成若干列的形式. 例子: 拆分以逗号为分隔符的字 ...

  6. BZOJ1183 Croatian2008 Umnozak 【数位DP】*

    BZOJ1183 Croatian2008 Umnozak Description 定义一个数的digit-product是它的各个位上的数字的乘积,定义一个数的self-product是它本身乘以它 ...

  7. C++ sort 函数用法

    MSDN中的定义: template<class RanIt>void sort(RanIt first, RanIt last); //--> 1)template<clas ...

  8. python: delete the duplicates in a list

    下面有几种做法,  其中3之简洁令人惊讶. 1, >>> t = [1, 2, 3, 1, 2, 5, 6, 7, 8] >>> t [1, 2, 3, 1, 2, ...

  9. 收藏一下mybatis全局参数配置

    http://blog.csdn.net/shaoduo/article/details/54285981

  10. adobe reader DC 字体设置

    adobe reader DC 字体设置 一直使用adobe reader阅读pdf文档,系统提醒我升级一个reader助手, 升级之后: 感觉字体颜色变浅,笔画也变细了,整体有些模糊不清. goog ...