当前位置: 首页 > news >正文

“头文件“

 C语言头文件:

#include<stdio.h>

万能头:

#include<bits/stdc++.h>
using namespace std;

 C++中也可以使用C语言头文件,所以可以将两者结合:

#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;

math是数学函数头文件,虽然被<bits/stdc++.h>包括,但也可以融合进来:

#include<stdio.h>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

我们也可以再融合几种:

#include<fenv.h>
#include<float.h>
#include<stdio.h>
#include<math.h>
#include<bits/stdc++.h>
using namespace std;

ANSI C共包括15个头文件。1995年,Normative Addendum 1(NA1)批准了3个头文件(iso646.h、wchar.h和wctype.h)增加到C标准函数库中。C99标准增加6个头文件(complex.h、fenv.h、inttypes.h、stdbool.h、stdint.h和tgmath.h)。C11标准中又新增了5个头文件(stdalign.h、stdatomic.h、stdnoreturn.h、threads.h和uchar.h)。
见下表:

C标准函数库共有29个头文件

 根据上表,我们可以制作出极为夸张的头文件:

#include<stdio.h> 
#include<assert.h> 
#include<complex.h> 
#include<ctype.h>
#include<errno.h>
#include<fenv.h>
#include<float.h>
#include<inttypes.h> 
#include<iso646.h>
#include<limits.h>  
#include<locale.h> 
#include<math.h> 
#include<setjmp.h>
#include<signal.h>
#include<stdalign.h>
#include<stdarg.h>
#include<stdbool.h>
#include<stddef.h>
#include<stdint.h>
#include<stdlib.h>
#include<string.h>
#include<tgmath.h>
#include<time.h>
#include<wchar.h>
int main()
{return 0;
}

再把以上头文件加上最开始介绍的万能头,就会变得非常离谱:

#include<bits/stdc++.h>
#include<stdio.h> 
#include<assert.h> 
#include<complex.h> 
#include<ctype.h>
#include<errno.h>
#include<fenv.h>
#include<float.h>
#include<inttypes.h> 
#include<iso646.h>
#include<limits.h>  
#include<locale.h> 
#include<math.h> 
#include<setjmp.h>
#include<signal.h>
#include<stdalign.h>
#include<stdarg.h>
#include<stdbool.h>
#include<stddef.h>
#include<stdint.h>
#include<stdlib.h>
#include<string.h>
#include<tgmath.h>
#include<time.h>
#include<wchar.h>
using namespace std;
int main()
{return 0;
}

现在,我们可以很轻松的把一个普通的代码改成一个含有大量头文件的较长代码。

#include <stdio.h>
void main()
{int a,b,c,sum;a=1; b=2; c=3;sum = a+b+c;printf("%d", sum);
}

改装后:

#include<bits/stdc++.h>
#include<stdio.h> 
#include<assert.h> 
#include<complex.h> 
#include<ctype.h>
#include<errno.h>
#include<fenv.h>
#include<float.h>
#include<inttypes.h> 
#include<iso646.h>
#include<limits.h>  
#include<locale.h> 
#include<math.h> 
#include<setjmp.h>
#include<signal.h>
#include<stdalign.h>
#include<stdarg.h>
#include<stdbool.h>
#include<stddef.h>
#include<stdint.h>
#include<stdlib.h>
#include<string.h>
#include<tgmath.h>
#include<time.h>
#include<wchar.h>
using namespace std;
int main()
{int a,b,c,sum;a=1; b=2; c=3;sum = a+b+c;printf("%d", sum);
}

参考资料:C语言-C语言概述_mooczhimahu-的博客-CSDN博客


http://www.taodudu.cc/news/show-6111849.html

相关文章:

  • 【physx/wasm】在physx中添加自定义接口并重新编译wasm
  • excel---常用操作
  • Lora训练Windows[笔记]
  • linux基础指令讲解(ls、pwd、cd、touch、mkdir)
  • InnoDB 事务处理机制
  • 启明云端ESP32 C3 模组WT32C3通过 MQTT 连接 AWS
  • 坐南京13路公交车,体验《头文字D》感觉!
  • 头文字D美图
  • 头文件大全
  • 头文件知多少?
  • 文件头编码
  • 头文件我来啦
  • m=m++到底发生了什么
  • 一路向北(电影《头文字D》主题曲)铃声 一路向北(电影《头文字...
  • 什么是头文件
  • java手机版头文字d_头文字D THE ARCADE
  • C++头文件一览
  • author-头文字注释
  • 文件内容后面有^M
  • 字符 ^M
  • 阜和SAP FICO模块课程
  • 【Python】判断闰年 + Calendar模块
  • css单个边框样式
  • html-css-边框样式
  • 前端css样式如何设置内边框
  • CSS盒子边框(border)样式综合样式
  • css常用样式(文字样式、边框样式、背景样式)
  • css 样式边框
  • 纯CSS实现的好看的边框
  • CSS 控制边框样式
  • css3中边框的4种样式
  • HTML-用css样式定义div的边框样式
  • CSS之背景样式及边框样式
  • 解决UE4打包Android报错app:packageDebug FAILED的一个土方法
  • 第一个很土很土很可爱的程序
  • 「土」巨石滚滚