C语言头文件,conio.h,windows.h,string.h,math.h各有什么用?

尽量详细,谢谢

conio.h不是C标准库中的头文件。 conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。
[编辑本段]包含的函数
包含的函数: cgets(char *); cprintf(const char *, ...); cputs(const char *); cscanf(const char *, ...); inp(unsigned short); inpw(unsigned short); getch(void); getche(void); kbhit(void); outp(unsigned short, int); outpw(unsigned short, unsigned short); putch(int); ungetch(int); void _Cdecl clreol (void); void _Cdecl clrscr (void); void _Cdecl delline (void); int _Cdecl gettext (int left, int top, int right, int bottom, void *destin); void _Cdecl gettextinfo (struct text_info *r); void _Cdecl gotoxy (int x, int y); void _Cdecl highvideo (void); void _Cdecl insline (void); void _Cdecl lowvideo (void); int _Cdecl movetext (int left, int top, int right, int bottom, int destleft, int desttop); void _Cdecl normvideo (void); int _Cdecl puttext (int left, int top, int right, int bottom, void *source); void _Cdecl textattr (int newattr); void _Cdecl textbackground (int newcolor); void _Cdecl textcolor (int newcolor); void _Cdecl textmode (int newmode); int _Cdecl wherex (void); int _Cdecl wherey (void); void _Cdecl window (int left, int top, int right, int bottom); har *_Cdecl cgets (char *str); int _Cdecl cprintf (const char *format, ...); int _Cdecl cputs (const char *str); int _Cdecl cscanf (const char *format, ...); int _Cdecl getch (void); int _Cdecl getche (void); char *_Cdecl getpass (const char *prompt); int _Cdecl kbhit (void); int _Cdecl putch (int c); int _Cdecl ungetch (int ch);

windows.h

Windows程序的开头都可看到: #include <windows.h> WINDOWS.H是主要的头文件,它包含了其他Windows头文件,这些头文件的某些也包含了其他头文件。这些头文件中最重要的和最基本的是: WINDEF.H 基本型态定义。 WINNT.H 支援Unicode的型态定义。 WINBASE.H Kernel函数。 WINUSER.H 使用者介面函数。 WINGDI.H 图形装置介面函数。 这些头文件定义了Windows的所有资料型态、函数调用、资料结构和常数识别字,它们是Windows文件中的一个重要部分。
[编辑本段]文件内容
/*++ BUILD Version: 0001 Increment this if a change has global effects Copyright (c) Microsoft Corporation. All rights reserved. Module Name: windows.h Abstract: Master include file for Windows applications. --*/ #ifndef _WINDOWS_ #define _WINDOWS_ #ifdef __BORLANDC__ #pragma defineonoption __BOROPT_A -A #pragma defineonoption __BOROPT_H -H #if (__BORLANDC__ == 0x550) && defined(__BOROPT_A) && defined(__BOROPT_H) #error The use of both -A (ANSI mode) and -H (pre-compiled headers) at the same time is unsupported. #endif #endif /* __BORLANDC__ */ #pragma option push -b -a8 -pc -A- /*P_O_Push*/ #ifndef WINVER #define WINVER 0x0501 #else #if defined(_WIN32_WINNT) && (WINVER < 0x0400) && (_WIN32_WINNT > 0x0400) #error WINVER setting conflicts with _WIN32_WINNT setting #endif #endif #ifndef _INC_WINDOWS #define _INC_WINDOWS #if defined (_MSC_VER) && (_MSC_VER >= 1020) #pragma once #endif /* If defined, the following flags inhibit definition * of the indicated items. * * NOGDICAPMASKS - CC_*, LC_*, PC_*, CP_*, TC_*, RC_ * NOVIRTUALKEYCODES - VK_* * NOWINMESSAGES - WM_*, EM_*, LB_*, CB_* * NOWINSTYLES - WS_*, CS_*, ES_*, LBS_*, SBS_*, CBS_* * NOSYSMETRICS - SM_* * NOMENUS - MF_* * NOICONS - IDI_* * NOKEYSTATES - MK_* * NOSYSCOMMANDS - SC_* * NORASTEROPS - Binary and Tertiary raster ops * NOSHOWWINDOW - SW_* * OEMRESOURCE - OEM Resource values * NOATOM - Atom Manager routines * NOCLIPBOARD - Clipboard routines * NOCOLOR - Screen colors * NOCTLMGR - Control and Dialog routines * NODRAWTEXT - DrawText() and DT_* * NOGDI - All GDI defines and routines * NOKERNEL - All KERNEL defines and routines * NOUSER - All USER defines and routines * NONLS - All NLS defines and routines * NOMB - MB_* and MessageBox() * NOMEMMGR - GMEM_*, LMEM_*, GHND, LHND, associated routines * NOMETAFILE - typedef METAFILEPICT * NOMINMAX - Macros min(a,b) and max(a,b) * NOMSG - typedef MSG and associated routines * NOOPENFILE - OpenFile(), OemToAnsi, AnsiToOem, and OF_* * NOSCROLL - SB_* and scrolling routines * NOSERVICE - All Service Controller routines, SERVICE_ equates, etc. * NOSOUND - Sound driver routines * NOTEXTMETRIC - typedef TEXTMETRIC and associated routines * NOWH - SetWindowsHook and WH_* * NOWINOFFSETS - GWL_*, GCL_*, associated routines * NOCOMM - COMM driver routines * NOKANJI - Kanji support stuff. * NOHELP - Help engine interface. * NOPROFILER - Profiler interface. * NODEFERWINDOWPOS - DeferWindowPos routines * NOMCX - Modem Configuration Extensions */ #if defined(RC_INVOKED) && !defined(NOWINRES) #include <winresrc.h> #else #if defined(RC_INVOKED) /* Turn off a bunch of stuff to ensure that RC files compile OK. */ #define NOATOM #define NOGDI #define NOGDICAPMASKS #define NOMETAFILE #define NOMINMAX #define NOMSG #define NOOPENFILE #define NORASTEROPS #define NOSCROLL #define NOSOUND #define NOSYSMETRICS #define NOTEXTMETRIC #define NOWH #define NOCOMM #define NOKANJI #define NOCRYPT #define NOMCX #endif #if defined(__BORLANDC__) && defined(__cplusplus) # include <mem.h> // Needed for protos of memxxx() routines #endif #if defined(__BORLANDC__) # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0500 /* If not set, assume NT 5.00 */ # endif # if defined(__cplusplus) # define NOMINMAX /* for WINDEF.H */ # else # define NONAMELESSUNION /* for OAIDL.H, OBJIDL.H,... */ # endif # if defined(_UNICODE) # define UNICODE # endif #endif #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86) #define _X86_ #endif #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_AMD64) #define _AMD64_ #endif #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_M68K) #define _68K_ #endif #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_MPPC) #define _MPPC_ #endif #if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_M_IX86) && !defined(_AMD64_) && defined(_M_IA64) #if !defined(_IA64_) #define _IA64_ #endif // !_IA64_ #endif #ifndef _MAC #if defined(_68K_) || defined(_MPPC_) #define _MAC #endif #endif #if defined (_MSC_VER) #if ( _MSC_VER >= 800 ) #ifndef __cplusplus #pragma warning(disable:4116) // TYPE_ALIGNMENT generates this - move it // outside the warning push/pop scope. #endif #endif #endif #ifndef RC_INVOKED #if ( _MSC_VER >= 800 ) || defined(__BORLANDC__) #pragma warning(disable:4514) #ifndef __WINDOWS_DONT_DISABLE_PRAGMA_PACK_WARNING__ #pragma warning(disable:4103) #endif #if _MSC_VER >= 1200 #pragma warning(push) #endif #pragma warning(disable:4001) #pragma warning(disable:4201) #pragma warning(disable:4214) #endif #include <excpt.h> #include <stdarg.h> #endif /* RC_INVOKED */ #include <windef.h> #include <winbase.h> #include <wingdi.h> #include <winuser.h> #if !defined(_MAC) || defined(_WIN32NLS) #include <winnls.h> #endif #ifndef _MAC #include <wincon.h> #include <winver.h> #endif #if !defined(_MAC) || defined(_WIN32REG) #include <winreg.h> #endif #ifndef _MAC #include <winnetwk.h> #endif #ifndef WIN32_LEAN_AND_MEAN #include <cderr.h> #include <dde.h> #include <ddeml.h> #include <dlgs.h> #ifndef _MAC #include <lzexpand.h> #include <mmsystem.h> #include <nb30.h> #include <rpc.h> #endif #include <shellapi.h> #ifndef _MAC #include <winperf.h> #include <winsock.h> #endif #ifndef NOCRYPT #include <wincrypt.h> #include <winefs.h> #include <winscard.h> #endif #ifndef NOGDI #ifndef _MAC #include <winspool.h> #ifdef INC_OLE1 #include <ole.h> #else #include <ole2.h> #endif /* !INC_OLE1 */ #endif /* !MAC */ #include <commdlg.h> #endif /* !NOGDI */ #endif /* WIN32_LEAN_AND_MEAN */ #include <stralign.h> #ifdef _MAC #include <winwlm.h> #endif #ifdef INC_OLE2 #include <ole2.h> #endif /* INC_OLE2 */ #ifndef _MAC #ifndef NOSERVICE #include <winsvc.h> #endif #if(WINVER >= 0x0400) #ifndef NOMCX #include <mcx.h> #endif /* NOMCX */ #ifndef NOIME #include <imm.h> #endif #endif /* WINVER >= 0x0400 */ #endif #ifndef RC_INVOKED #if ( _MSC_VER >= 800 ) || defined(__BORLANDC__) #if _MSC_VER >= 1200 #pragma warning(pop) #else #pragma warning(default:4001) #pragma warning(default:4201) #pragma warning(default:4214) /* Leave 4514 disabled. It's an unneeded warning anyway. */ #endif #endif #endif /* RC_INVOKED */ #endif /* RC_INVOKED */ #endif /* _INC_WINDOWS */ #pragma option pop /*P_O_Pop*/ #endif /* _WINDOWS_ */

string.h

C语言里面关于字符数组的函数定义的头文件,常用函数有strlen、strcmp、strcpy等等,更详细的可以到include文件夹里面查看该文件。 下面更详细的介绍下: /***********************************************************************/ C、传统 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 <fenv.h> //浮点环境 #include <inttypes.h> //整数格式转换 #include <stdbool.h> //布尔环境 #include <stdint.h> //整型环境 #include <tgmath.h> //通用类型数学宏 /***********************************************************************/

math.h

数学函数库,一些数学计算的公式的具体实现是放在math.h里,具体有: 1 三角函数 double sin (double); double cos (double); double tan (double); 2 反三角函数 double asin (double); 结果介于[-PI/2, PI/2] double acos (double); 结果介于[0, PI] double atan (double); 反正切(主值), 结果介于[-PI/2, PI/2] double atan2 (double, double); 反正切(整圆值), 结果介于[-PI/2, PI/2] 3 双曲三角函数 double sinh (double); double cosh (double); double tanh (double); 4 指数与对数 double exp (double); double sqrt (double); double log (double); 以e为底的对数 double log10 (double); double pow(double x, double y)//计算以x为底数的y次幂 5 取整 double ceil (double); 取上整 double floor (double); 取下整 6 绝对值 double fabs (double); double cabs(struct complex znum) //求复数的绝对值 7 标准化浮点数 double frexp (double f, int *p); 标准化浮点数, f = x * 2^p, 已知f求x, p ( x介于[0.5, 1] ) double ldexp (double x, int p); 与frexp相反, 已知x, p求f 8 取整与取余 double modf (double, double*); 将参数的整数部分通过指针回传, 返回小数部分 double fmod (double, double); 返回两参数相除的余数 9其他 double hypot(double x, double y);//已知直角三角形两个直角边长度,求斜边长度 double ldexp(double x, int exponent);//计算x*(2的exponent次幂) double poly(double x, int degree, double coeffs [] )//计算多项式 nt matherr(struct exception *e)//数学错误计算处理程序 source: 《C & C++ Code Capsules》

参考资料:百度百科

温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-07-28
conio.h 不是C标准库中的头文件。主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等

windows.h 是主要的头文件,它包含了其他Windows头文件,这些头文件的某些也包含了其他头文件。这些头文件中最重要的和最基本的是:
WINDEF.H 基本型态定义。
WINNT.H 支援Unicode的型态定义。
WINBASE.H Kernel函数。
WINUSER.H 使用者介面函数。
WINGDI.H 图形装置介面函数。
这些头文件定义了Windows的所有资料型态、函数调用、资料结构和常数识别字,它们是Windows文件中的一个重要部分。

string.h

C语言里面关于字符数组的函数定义的头文件,常用函数有strlen、strcmp、strcpy等等,更详细的可以到include文件夹里面查看该文件。

math.h

数学函数库,一些数学计算的公式的具体实现是放在math.h里,具体有:
1 三角函数
double sin (double);
double cos (double);
double tan (double);
2 反三角函数
double asin (double); 结果介于[-PI/2, PI/2]
double acos (double); 结果介于[0, PI]
double atan (double); 反正切(主值), 结果介于[-PI/2, PI/2]
double atan2 (double, double); 反正切(整圆值), 结果介于[-PI/2, PI/2]
3 双曲三角函数
double sinh (double);
double cosh (double);
double tanh (double);
4 指数与对数
double exp (double);
double sqrt (double);
double log (double); 以e为底的对数
double log10 (double);
double pow(double x, double y)//计算以x为底数的y次幂
5 取整
double ceil (double); 取上整
double floor (double); 取下整
6 绝对值
double fabs (double);
double cabs(struct complex znum) //求复数的绝对值
7 标准化浮点数
double frexp (double f, int *p); 标准化浮点数, f = x * 2^p, 已知f求x, p ( x介于[0.5, 1] )
double ldexp (double x, int p); 与frexp相反, 已知x, p求f
8 取整与取余
double modf (double, double*); 将参数的整数部分通过指针回传, 返回小数部分
double fmod (double, double); 返回两参数相除的余数
9其他
double hypot(double x, double y);//已知直角三角形两个直角边长度,求斜边长度
double ldexp(double x, int exponent);//计算x*(2的exponent次幂)
double poly(double x, int degree, double coeffs [] )//计算多项式
nt matherr(struct exception *e)//数学错误计算处理程序
source: 《C & C++ Code Capsules》

参考资料:百度百科

第2个回答  2010-07-28
conio.h,windows.h不是标准库的
string.h math.h是标准库中的

string.h主要提供处理字符串的一些函数
math.h主要提供一些数学函数

windows.h提供windows编程的接口,头文件等
conio.h 提供控制台输入输出的一些函数
相似回答