C语言常见头文件计算机二级必备
- 格式:pdf
- 大小:62.83 KB
- 文档页数:6
标准C语言头文件ISO C标准定义的头文件(24项)<assert。
h> 验证程序断言〈complex。
h〉支持复数算术运算〈ctype。
h〉字符类型<errno。
h〉出错码<fenv。
h> 浮点环境〈float。
h> 浮点常量<inttypes。
h> 整型格式转换〈iso646.h〉替代关系操作符宏〈limits。
h> 实现常量<locale.h〉局部类别<math。
h〉数学常量〈setjmp.h> 非局部goto〈signal。
h> 信号〈stdarg。
h〉可变参数表〈stdbool.h> 布尔类型和值〈stddef。
h> 标准定义〈stdint.h〉整型<stdio。
h〉标准I/O库〈stdlib.h〉实用程序库函数〈string。
h〉字符串操作<tgmath.h〉通用类型数学宏<time.h> 时间和日期〈wchar。
h〉宽字符支持〈wctype.h〉宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)〈dirent.h〉目录项<fcntl.h> 文件控制〈fnmatch。
h> 文件名匹配类型〈glob。
h> 路径名模式匹配类型〈grp。
h> 组文件〈netdb.h> 网络数据库操作〈pwd.h〉口令文件<regex。
h> 正则表达式〈tar。
h> tar归档值<termios。
h> 终端I/O <unistd.h> 符号常量<utime.h〉文件时间<wordexp。
h〉字扩展类型<arpa/inet.h> Internet定义<net/if.h> 套接字本地接口〈netinet/in.h> Internet地址族 <netinet/tcp.h〉传输控制协议〈sys/mman。
C语言的开头格式通常包括头文件和main函数,具体如下:
1. 头文件:#include <stdio.h>
这是一个预处理指令,它指示编译器在编译过程中引入标准输入输出库(stdio.h),以便后续的程序可以使用标准输入输出函数,例如printf()和scanf()等。
2. main函数:int main()
这是C语言程序的入口函数,程序将从这里开始执行。
main函数必须返回一个整数值,通常情况下,返回值为0表示程序正常结束,非0值则表示程序异常结束。
在main函数中可以编写程序代码,完成特定的任务。
例如,可以编写代码来计算两个数的和、输出一段文本、读取用户输入等等。
精品文档
. 计算机二级考试C语言知识点总结
(完全针对考试大纲)
概述
总体上必须清楚的:
1)程序结构是三种: 顺序结构, 循环结构(三个循环结构), 选择结构(if 和switch)
2)读程序都要从main()入口, 然后从最上面顺序往下读(碰到循环做循环,碰到选择做选择)。
3)计算机的数据在电脑中保存是以二进制的形式. 数据存放的位置就是他的地址.
4)bit是位是指为0 或者1。
byte 是指字节, 一个字节= 八个位.
5)一定要记住二进制如何划成十进制。
概念常考到的:
1)、编译预处理不是C语言的一部分,不再运行时间。
C语言编译的程序称为源程序,它以ASCII数值存放在文本文件中。
2)、每个C语言程序中main函数是有且只有一个。
3)、在函数中不可以再定义函数。
4)、算法的是一定要有输出的,他可以没有输入。
5)、break可用于循环结构和switch语句。
6)、逗号运算符的级别最低。
第一章
1)合法的用户标识符考查:
合法的要求是由字母,数字,下划线组成。
有其它元素就错了。
并且第一个必须为字母或则是下划线。
第一个为数字就错了。
关键字不可以作为用户标识符号。
main define scanf printf 都不是关键字。
迷惑你的地方If是可以做为用户标识符。
因为If中的第一个字母大写了,所以不是关键字。
#include <complex>//复数类#include <csignal> //信号机制支持#include <csetjmp> //异常处理支持#include <cstdarg> //不定参数列表支持#include <cstddef> //常用常量#include <cstdio> //定义输入/输出函数#include <cstdlib> //定义杂项函数及内存分配函数#include <cstring> //字符串处理#include <ctime> //定义关于时间的函数#include <cwchar> //宽字符处理及输入/输出#include <cwctype> //宽字符分类#include <deque>//STL 双端队列容器#include <exception>//异常处理类#include <fstream> //文件输入/输出#include <functional>//STL 定义运算函数(代替运算符)#include <limits> //定义各种数据类型最值常量#include <list>//STL 线性列表容器#include <locale> //本地化特定信息#include <map>//STL 映射容器#include <memory> //STL通过分配器进行的内存分配#include <new> //动态内存分配#include <numeric> //STL常用的数字操作#include <iomanip> //参数化输入/输出#include <ios>//基本输入/输出支持#include <iosfwd>//输入/输出系统使用的前置声明#include <iostream> //数据流输入/输出#include <istream>//基本输入流#include <iterator> //STL迭代器#include <ostream>//基本输出流#include <queue>//STL 队列容器#include <set>//STL 集合容器#include <sstream>//基于字符串的流#include <stack>//STL 堆栈容器#include <stdexcept>//标准异常类#include <streambuf>//底层输入/输出支持#include <string>//字符串类#include <typeinfo> //运行期间类型信息#include <utility>//STL 通用模板类#include <valarray> //对包含值的数组的操作#include <vector>//STL 动态数组容器————————————————————————————————C99增加的部分#include <complex.h>//复数处理#include <fenv.h>//浮点环境#include <inttypes.h>//整数格式转换#include <stdbool.h>//布尔环境#include <stdint.h>//整型环境#include <tgmath.h>//通用类型数学宏头文件ctype.h字符处理函数: 本类别函数用于对单个字符进行处理,包括字符的类别测试和字符的大小写转换----------------------------------------字符测试是否字母和数字isalnum是否字母isalpha是否控制字符iscntrl是否数字isdigit是否可显示字符(除空格外) isgraph是否可显示字符(包括空格) isprint是否既不是空格,又不是字母和数字的可显示字符ispunct是否空格isspace是否大写字母isupper是否16进制数字(0-9,A-F)字符isxdigit字符大小写转换函数转换为大写字母toupper转换为小写字母tolower头文件local.h地区化: 本类别的函数用于处理不同国家的语言差异。
2.3 头⽂件、数据说明、函数的开始和结束标志
1.头⽂件:也称为包含⽂件或标题⽂件,⼀般放在⼀个C语⾔程序的开头,⽤#include″⽂件名″的格式,其中⽂件名是头⽂件名,⼀般⽤.h作为扩展名。
2.数据说明:C语⾔中的数据分常量和变量两种。
3.常量:有数值常量和符号常量两种。
4.数值常量:可以分为整型常量、实型常量、浮点型常量和字符常量。
5.符号常量:⽤⼀个标识符代表的⼀个常量,⼜称标识符形式的常量。
6.变量:其值可以改变的量,变量名习惯上⽤⼩写字母表⽰。
7.标识符:⽤来标识变量名、符号常量名、函数名、数组名、类型名、⽂件名的有效字符序列。
8.标识符的命名规则:C语⾔中标识符只能由字母、数字下划线三种字符组成,且第⼀个字符必须为字母或下划线。
C语⾔是⼤⼩写敏感语⾔,即对⼤⼩写字母认为是不同的字符。
C语⾔中标识符的长度随系统不同⽽字,如TURBO C中取前8个字符,8个字符后⾯的字符会⾃动取消。
标准C语言头文件ISO C标准定义的头文件(24项)<assert.h> 验证程序断言<complex.h> 支持复数算术运算<ctype.h> 字符类型<errno.h> 出错码<fenv.h> 浮点环境<float.h> 浮点常量<inttypes.h> 整型格式转换<iso646.h> 替代关系操作符宏<limits.h> 实现常量<locale.h> 局部类别<math.h> 数学常量<setjmp.h> 非局部goto<signal.h> 信号<stdarg.h> 可变参数表<stdbool.h> 布尔类型和值<stddef.h> 标准定义<stdint.h> 整型<stdio.h> 标准I/O库<stdlib.h> 实用程序库函数<string.h> 字符串操作<tgmath.h> 通用类型数学宏<time.h> 时间和日期<wchar.h> 宽字符支持<wctype.h> 宽字符分类和映射支持POSIX标准定义的必须的头文件(26项)<dirent.h> 目录项<fcntl.h> 文件控制<fnmatch.h> 文件名匹配类型<glob.h> 路径名模式匹配类型<grp.h> 组文件<netdb.h> 网络数据库操作<pwd.h> 口令文件<regex.h> 正则表达式<tar.h> tar归档值<termios.h> 终端I/O <unistd.h> 符号常量<utime.h> 文件时间<wordexp.h> 字扩展类型<arpa/inet.h> Internet定义<net/if.h> 套接字本地接口<netinet/in.h> Internet地址族 <netinet/tcp.h> 传输控制协议<sys/mman.h> 内存管理声明<sys/select.h> select函数<sys/socket.h> 套接字接口<sys/stat.h> 文件状态<sys/times.h> 进程时间<sys/types.h> 基本系统数据类型<sys/un.h> UNIX域套接字定义<sys/utsname.h>系统名<sys/wait.h> 进程控制POSIX标准定义的XSI扩展头文件(26项)<cpio.h> cpio归档值<dlfcn.h> 动态链接<fmtmsg.h> 消息显示结构<ftw.h> 文件树漫游<iconv.h> 代码集转换实用程序<langinfo.h> 语言信息常量<libgen.h> 模式匹配函数定义<monetary.h> 货币类型<ndbm.h> 数据库操作<nl_types.h> 消息类别<poll.h> 轮询函数<search.h> 搜索表<strings.h> 字符串操作<syslog.h> 系统出错日志记录<ucontext.h> 用户上下文<ulimit.h> 用户限制<utmpx.h> 用户帐户数据库<sys/ipc.h> IPC<sys/msg.h> 消息队列<sys/resource.h> 资源操作<sys/sem.h> 信号量<sys/shm.h> 共享存储<sys/statvfs.h> 文件系统信息<sys/time.h> 时间类型<sys/timeb.h> 附加的时间<sys/uio.h> 矢量I/O操作POSIX标准定义的可选头文件(8项)<aio.h> 异步I/O <mqueue.h> 消息队列<pthread.h> 线程<sched.h> 执行调度<semaphore.h> 信号量<spawn.h> 实时spawn接口<stropts.h> XSI STREAMS接口<trace.h> 时间跟踪标准 C++ 语言头文件(54个其中16个用于构建STL,3个为附加非必须)<algorithm>STL通用算法<bitset> STL位集容器<cassert> 用于在程序运行时执行断言<cctype> 字符处理<cerrno> 错误码<cfloat> 用于测试浮点类型属性<ciso646> ISO646变体字符集<climits> 测试整数类型属性<clocale> 本地化函数<cmath> 数学函数<complex>复数类<csetjmp> 执行非内部的goto语句<csignal> 信号<cstdarg> 访问参数数量变化的函数<cstddef> 用于定义实用的类型和宏<cstdio> 输入/输出<cstdlib> 杂项函数及内存分配<cstring> 字符串<ctime> 时间<cwchar> 宽字符处理及输入/输出<cwctype> 宽字符分类<deque> STL双端队列容器<exception> 异常处理类<fstream> 文件流<functional> STL函数对象<iomanip> 参数化输入/输出<ios>基本输入/输出支持<iosfwd> 输入/输出前置声明<iostream> 数据流输入/输出<istream> 基本输入流<iterator> 遍历序列的类<limits> 各种数据类型最值常量<list>STL线性列表容器<locale> 国际化支持<map> STL映射容器<memory> 专用内存分配器<new> 基本内存分配和释放<numeric> 通用的数字操作<ostream> 基本输出流<queue> STL 队列容器<set> STL 集合容器<sstream> 基于字符串的流<stack> STL 堆栈容器<stdexcept> 标准异常类<streambuf> iostream 的缓冲区类<string> 字符串类<strstream> 非内存字符序列的流类<typeinfo> 运行时类型标识<utility> STL 通用模板类<valarray> 支持值数组的类和模版类<vector> STL 动态数组容器标准C++附加的头文件(3个)非必须<hash_map> <hash_set> <slist>The Standard C++ library consists of 51 required headers.This implementation also includes three additional headers,<hash_map>,<hash_set>,and <slist>,not required by the C++ Standard,for a total of 54 headers.Of these 54 headers,16 constitute the Standard Template Library,or STL.These are indicated below with the notation<algorithm> -- (STL) for defining numerous templates that implement useful algorithms<bitset> -- for defining a template class that administers sets of bits<complex> -- for defining a template class that supports complex arithmetic<deque> -- (STL) for defining a template class that implements a deque container<exception> -- for defining several functions that control exception handling<fstream> -- for defining several iostreams template classes that manipulate exteral files<functional>-- (STL) for defining several templates that help construct predicates for the templates defined in <algorithm> and <numeric><hash_map> -- (STL) for defining template classes that implement hashed associative containersthat map keys to values<hash_set> -- (STL) for defining template classes that implement hashed associative containers<iomanip> -- for declaring several iostreams manipulators that take an argument<ios> -- for defining the template class that serves as the base for many iostreams classes<iosfwd> -- for declaring several iostreams template classes before they are necessarilydefined<iostream> -- for declaring the iostreams objects that manipulate the standard streams<istream> -- for defining the template class that performs extractions<iterator> -- (STL) for defining several templates that help define and manipulate iterators<limits> -- for testing numeric type properties<list>-- (STL) for defining a template class that implements a doubly linked list container<locale> -- for defining several classes and templates that controllocale-specific behavior, as in the iostreams classes<map>-- (STL) for defining template classes that implement associative containers thatmap keys to values<memory>-- (STL) for defining several templates that allocate and free storage for variouscontainer classes<new> -- for declaring several functions that allocate and free storage<numeric>-- (STL) for defining several templates that implement useful numeric functions<ostream> -- for defining the template class that performs insertions<queue> -- (STL) for defining a template class that implements a queue container<set>-- (STL) for defining template classes that implement associative containers<slist>-- (STL) for defining a template class that implements a singly linked list container<sstream> -- for defining several iostreams template classes that manipulate string containers<stack> -- (STL) for defining a template class that implements a stack container<stdexcept> -- for defining several classes useful for reporting exceptions<streambuf> -- for defining template classes that buffer iostreams operations<string> -- for defining a template class that implements a string container<strstream> -- for defining several iostreams classes that manipulate in-memory character sequences<typeinfo> -- for defining class type_info, the result of the typeid operator<utility>-- (STL) for defining several templates of general utility<valarray> -- for defining several classes and template classes that support value-oriented arrays<vector>-- (STL) for defining a template class that implements a vector container新的C标准库<cassert> -- for enforcing assertions when functions execute<cctype> -- for classifying characters<cerrno> -- for testing error codes reported by library functions<cfloat> -- for testing floating-point type properties<ciso646> -- for programming in ISO 646 variant character sets<climits> -- for testing integer type properties<clocale> -- for adapting to different cultural conventions<cmath> -- for computing common mathematical functions<csetjmp> -- for executing nonlocal goto statements<csignal> -- for controlling various exceptional conditions<cstdarg> -- for accessing a varying number of arguments<cstddef> -- for defining several useful types and macros<cstdio> -- for performing input and output<cstdlib> -- for performing a variety of operations<cstring> -- for manipulating several kinds of strings<ctime> -- for converting between various time and date formats<cwchar> -- for manipulating wide streams and several kinds of strings<cwctype> -- for classifying wide characters旧的C标准库<assert.h> -- for enforcing assertions when functions execute<ctype.h> -- for classifying characters<errno.h> -- for testing error codes reported by library functions<float.h> -- for testing floating-point type properties<iso646.h> -- for programming in ISO 646 variant character sets<limits.h> -- for testing integer type properties<locale.h> -- for adapting to different cultural conventions<math.h> -- for computing common mathematical functions<setjmp.h> -- for executing nonlocal goto statements<signal.h> -- for controlling various exceptional conditions<stdarg.h> -- for accessing a varying number of arguments<stddef.h> -- for defining several useful types and macros<stdio.h> -- for performing input and output<stdlib.h> -- for performing a variety of operations<string.h> -- for manipulating several kinds of strings<time.h> -- for converting between various time and date formats<wchar.h> -- for manipulating wide streams and several kinds of strings<wctype.h> -- for classifying wide charactersFinally, in this implementation, the Standard C++ library also includes several headers for compatibility with traditional C++ libraries:<fstream.h> -- for defining several iostreams template classes that manipulate exteral files <iomanip.h> -- for declaring several iostreams manipulators that take an argument<iostream.h> -- for declaring the iostreams objects that manipulate the standard streams <new.h> -- for declaring several functions that allocate and free storage<stl.h> -- for declaring several template classes that aid migration from older versions of the Standard Template Library。
全国计算机等级考试二级C语言考试复习资料及复习计划一、C语言的特点C语言是近年来非常流行的语言,很多人宁愿放弃已经熟悉的其他语言而改用C语言,其原因是C语言有优于其他语言的一系列特点.下面是C语言的主要特点:(1)语言简洁、紧凑,并且使用方便、灵活;(2)运算符丰富;(3)数据结构丰富;(4)具有结构化的控制语句;(5)语法限制不太严格,使程序设计比较自由;(6)C语言允许用户直接访问物理地址,能进行位(bit)操作,可以直接对硬件进行操作.二、源程序的书写规则C语言的书写规则.C语言书写格式自由,一行内可以写几个语句,一个语句也可以分写在多行上。
C程序没有行号,每个语句和数据定义的最后必须有一个分号。
C语言中分号是语句中不可少的,即使是程序中的最后一个语句也应该包含分号.C语言中的注释可以用″/*″用″*/″结束,注释可以在任何允许插入空格符的地方插入。
C语言中注释不允许嵌套,注释可以用西文,也可以用中文。
三、C语言的风格由于C语言对语法限制不太严格,为了保证程序的准确性和可读性,建议在书写程序采用阶梯缩进格式。
也就是按如下格式书写C 语言程序:**********;*****(){**********;********;{******;.。
.。
.。
}*********;}概括起来,C语言程序具有如下的风格: ①C语言程序的函数具体模块结构风格,使得程序整体结构清晰、层次清楚,为模块化程序设计提供了强有力的支持。
②C语言的源程序的扩展名都是。
C.③C语言中的注释格式为:/*注释内容*/ /与*之间不允许有空格,注释部分允许出现在程序中的任何位置。
④C语言中的所有语句都必须以分号“;"结束一、程序的构成尽管C程序的内容千变万化,但是它们的构成都是一致的,一个完整的C源程序的格式可以如下表示:编译预处理主函数()函数().。
函数()从上面中可以看出,一个C源程序实际上就是若干函数的集合,这些函数中有一个是程序的主函数,任何C的源程序执行时,都是从主函数开始执行的,其它的函数最终必将被这个主函数所调用。
计算机二级考试(C语言程序设计)大纲公共基础知识基本要求1.掌握算法的基本概念。
2.掌握基本数据结构及其操作。
3.掌握基本排序和查找算法。
4.掌握逐步求精的结构化程序设计方法。
5.掌握软件工程的基本方法,具有初步应用相关技术进行软件开发的能力。
6.掌握数据库的基本知识,了解关系数据库的设计。
考试内容一、基本数据结构与算法1.算法的基本概念;算法复杂度的概念和意义(时间复杂度与空间复杂度)。
2.数据结构的定义:数据的逻辑结构与存储结构;数据结构的图形表示;线性结构与非线性结构的慨念。
3.线性表的定义;线性表的顺序存储结构及其插入与删除运算。
4.栈和队列的定义;栈和队列的顺序存储结构及其基本运算。
5.线性单链表、双向链表与循环链表的结构及其基本运算。
6.树的基本概念;二叉树的定义及其存储结构;二叉树的前序、中序和后序遍历。
7.顺序查找与二分法查找算法;基本排序算法(交换类排序,选择类排序,插入类排序)。
二、程序设计基础1.程序设计方法与风格。
2.结构化程序设计。
3.面向对象的程序设计方法,对象,方法,属性及继承与多态性。
三、软件工程基础1.软件工程基本概念,软件生命周期概念,软件工具与软件开发环境。
2.结构化分析方法,数据流图,数据字典,软件需求规格说明书。
3.结构化设计方法,总体设计与详细设计。
4.软件测试的方法,白盒测试与黑盒测试,测试用例设计,软件测试的实施,单元测试、集成测试和系统测试。
5.程序的调试,静态调试与动态调试。
四、数据库设计基础1.数据库的基本概念:数据库,数据库管理系统,数据库系统。
2.数据模型,实体联系模型及E-R图,从E-R图导出关系数据模型。
3.关系代数运算,包括集合运算及选择、投影、连接运算,数据库规范化理论。
4.数据库设计方法和步歌:需求分析、概念设计、逻辑设计和物理设计的相关策略。
考试方式1.公共基础知识不单独考试,与其他二级科目组合在一起,作为二级科目考核内容的一部分。
C语言头文件大全#include <assert.h> //设定插入点#include <ctype.h> //字符处理#include <errno.h> //定义错误码#include <float.h> //浮点数处理#include <fstream.h> //文件输入/输出#include <iomanip.h> //参数化输入/输出#include <iostream.h> //数据流输入/输出#include <limits.h> //定义各种数据类型最值常量#include <locale.h> //定义本地化函数#include <math.h> //定义数学函数#include <stdio.h> //定义输入/输出函数#include <stdlib.h> //定义杂项函数及内存分配函数#include <string.h> //字符串处理#include <strstrea.h> //基于数组的输入/输出#include <time.h> //定义关于时间的函数#include <wchar.h> //宽字符处理及输入/输出#include <wctype.h> //宽字符分类////////////////////////////////////////////////////////////////////////// ////// 标准C++ (同上的不再注释)#include <algorithm> //STL通用算法#include <bitset> //STL位集容器#include <cctype>#include <cerrno>#include <clocale>#include <cmath>#include <complex> //复数类#include <cstdio>#include <cstdlib>#include <cstring>#include <ctime>#include <deque> //STL双端队列容器#include <exception> //异常处理类#include <fstream>#include <functional> //STL 定义运算函数(代替运算符)#include <limits>#include <list> //STL 线性列表容器#include <map> //STL 映射容器#include <iomanip>#include <ios> //基本输入/输出支持#include <iosfwd> //输入/输出系统使用的前置声明#include <iostream>#include <istream> //基本输入流#include <ostream> //基本输出流#include <queue> //STL 队列容器#include <set> //STL 集合容器#include <sstream> //基于字符串的流#include <stack> //STL 堆栈容器#include <stdexcept> //标准异常类#include <streambuf> //底层输入/输出支持#include <string> //字符串类#include <utility> //STL 通用模板类#include <vector> //STL 动态数组容器#include <cwchar>#include <cwctype>////////////////////////////////////////////////////////////////////////// ////// #include <complex.h> //复数处理#include <fenv.h> //浮点环境#include <inttypes.h> //整数格式转换#include <stdbool.h> //布尔环境#include <stdint.h> //整型环境#include <tgmath.h> //通用类型数学宏#include<conio.h> //说明调用DOS控制台I/O子程序的各个函数。
C语言常见头文件计算机二级必备
#include<assert.h>//设定插入点#include<ctype.h>//字符处理
#include<errno.h>//定义错误码
#include<float.h>//浮点数处理
#include<fstream.h>//文件输入/输出
#include<iomanip.h>//参数化输入/输出
#include<iostream.h>//数据流输入/输出
#include<limits.h>//定义各种数据类型最值常量
#include<locale.h>//定义本地化函数
#include<math.h>//定义数学函数
#include<stdio.h>//定义输入/输出函数
#include<stdlib.h>//定义杂项函数及内存分配函数
#include<string.h>//字符串处理
#include<strstrea.h>//基于数组的输入/输出
#include<time.h>//定义关于时间的函数
#include<wchar.h>//宽字符处理及输入/输出
#include<wctype.h>//宽字符分类
////////////////////////////////////////////////////////
//////////////////
标准C++(同上的不再注释)
#include<algorithm>//STL通用算法
#include<bitset>//STL位集容器
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>//复数类
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>//STL双端队列容器
#include<exception>//异常处理类
#include<fstream>
#include<functional>//STL定义运算函数(代替运算符)#include<limits>
#include<list>//STL线性列表容器
#include<map>//STL映射容器
#include<iomanip>
#include<ios>//基本输入/输出支持
#include<iosfwd>//输入/输出系统使用的前置声明
#include<iostream>
#include<istream>//基本输入流
#include<ostream>//基本输出流
#include<queue>//STL队列容器
#include<set>//STL集合容器
#include<sstream>//基于字符串的流
#include<stack>//STL堆栈容器
#include<stdexcept>//标准异常类
#include<streambuf>//底层输入/输出支持
#include<string>//字符串类
#include<utility>//STL通用模板类
#include<vector>//STL动态数组容器
#include<cwchar>
#include<cwctype>
using namespace std;
//////////////////////////////////////////////////////// //////////////////
C99增加
#include<complex.h>//复数处理
头文件最主要的功能是起到声明作用,比如说,在某个类中,你要用到如下头文件:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<strstrea.h>
你就可以自定义一个头文件,然后把这些头文件放到自定义的头文件中,然后在那个类开头包含自定义的头文件就行了,不需要再写以上头文件,这样就使代码显得简练易懂.
c++里面的类,函数,变量都有声明和定义的区别
在用到一个类或函数或变量之前,必须进行声明,但可以在之后定义。
比如
//声明go
int main(){
go();
}
int go(){
cout<<"go";
}
如果没有之前
的go的声明,在main中调用是会出错的
但把所有的声明都放在文件的开头会比较麻烦,而且,如果go这个函数在其他的文件中要用到时,在其他的文件里面也要对go()进行声明
//2.cpp
//声明go
int haha(){
go();
}
这样在文件很多时容易出错。
所以,我们就把所有的声明,如go的声明放在一个文件中,比如1.h.
这样,在2.cpp里面,只要#include"1.h",就可以直接调用go了。