C++标准库头文件<bits/stdc++.h>
在使用GNU GCC Compiler的时候,你可以包含一个头文件<bits/stdc++.h>,便可以使用C++中的各种标准库,而不用一个一个包含进来。
这在acm比赛中是一种常用的做法。接下来给大家看一下bits目录下的stdc++.h:
// C++ includes used for precompiling -*- C++ -*- // Copyright (C) 2003-2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version. // This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation. // You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>. /** @file stdc++.h
* This is an implementation file for a precompiled header.
*/ // 17.4.1.2 Headers // C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime> #if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif // C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector> #if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
这样在编程的时候就可以这样子做:
#include <bits/stdc++.h> using namespace std; int main()
{
while(true)
{
int n;
cin >> n;
if(n==-) break;
cout << n*n << endl;
}
return ;
}
如图:

简单方便不是吗?
C++标准库头文件<bits/stdc++.h>的更多相关文章
- C++万能头文件<bits/stdc++.h>的内容与优缺点
最近发现了一个C++的头文件bits/stdc++.h,听说这是一个几乎包含了所有C++库函数的头文件,就想更深入的了解一下,下面是头文件内容 // C++ includes used for pre ...
- C++ 中头文件<bits/stdc++.h>的优缺点
在编程竞赛中,我们常见一个头文件: #include <bits/stdc++.h> 发现它是部分C++中支持的一个几乎万能的头文件,包含所有的可用到的C++库函数,如<istrea ...
- 高级c++头文件bits/stdc++.h
用这种方法声明头文件只需两行代码 #include<bits/stdc++.h> using namespace std; 这个头文件包含以下等等C++中包含的所有头文件: #includ ...
- 2.头文件<bits/stdc++.h>
用这种方法声明头文件只需两行代码 #include<bits/stdc++.h> using namespace std; 这个头文件包含以下等等C++中包含的所有头文件: #inclu ...
- C++头文件<bits/stdc++.h>
在刷题时,总发现有的只写一行头文件 #include <bits/stdc++.h> . 查阅资料后,才知道原来:#include<bits/stdc++.h>包含了目前c++ ...
- C++标准库头文件名字和C语言头文件名字的区别
1.C++版本的C标准库头文件,一般是cname,而C语言头文件一般是name.h 2.命名为cname的头文件中定义的名字都是从std中来的,而如果是name.h则不是这样的. 3.与是用name. ...
- C++标准库头文件找不到的问题
当你写C++程序时,在头文件中包含C++标准库的头文件,比如#include <string>,而编译器提示你找不到头文件! 原因就是你的实现源文件扩展名是".c"而不 ...
- C++版本的C标准库头文件的特点
C++标准库中除了定义C++语言特有的功能外,也兼容了C语言的标准库.C语言的头文件形如name.h,C++则将这些文件命名为cname.也就是去掉了.h后缀,而在文件名name之前添加了字母c,这里 ...
- C 标准库头文件
头文件 说明 头文件 说明 <assert.h> 条件编译宏,将参数与零比较 <complex.h> (C99 起) 复数运算 <ctype.h> 用来确定包含于字 ...
随机推荐
- 使用JSTL的sql:query标签制作分页查询遇到NoSuchFieldError: deferredExpression
参考:http://hi.baidu.com/desyle/item/4fe650265792d7182a0f1c33 症状: 如题所述,代码如下 <sql:query var="re ...
- DelphiXE8FMX工程实现无边框托动(发送消息)
1.引用单元 uses Winapi.Windows, FMX.Platform.Win, Winapi.Messages; 2.发送消息 //发送系统消息SendMessage(FmxHandleT ...
- session退出页面
简单的session退出页面,jsp: <%@ page language="java" contentType="text/html; charset=utf-8 ...
- Unix系统编程()发送信号kill
与shell的kill命令类似,一个进程能够使用kill系统调用向另一进程发送信号. 之所以选择kill作为术语,因为早期UNIX实现中大多数信号的默认行为是终止进程. #include <si ...
- C语言 · Sine之舞
基础练习 Sine之舞 时间限制:1.0s 内存限制:512.0MB 问题描述 最近FJ为他的奶牛们开设了数学分析课,FJ知道若要学好这门课,必须有一个好的三角函数基本功.所以他准备和奶 ...
- HttpClient使用学习
import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apac ...
- ResNet 结构理解
博客来源于:https://blog.csdn.net/buyi_shizi/article/details/53336192:https://blog.csdn.net/dcrmg/article/ ...
- ios开发之 -- x-code删除描述文件
描述文件所在的目录是:~/Library/MobileDevice/Provisioning\ Profiles/ 进入这个目录,删除所有描述文件.
- Hadoop1.2.1 单机模式安装
首先安装JDK: 然后安装hadoop: 最后的实例测试:首先在 /opt/data 目录下创建 input目录, 然后把hadoop的conf目录下的所有xml文件拷贝到上面的input目录, 然后 ...
- sys.argv 详细用法
sys.argv 用于获取命令行参数,用法如下: [root@localhost ~]$ cat 1.py #!/usr/bin/env python #-*- coding:utf-8 -*- im ...