在C++中的#include<?>,<>里的?是有几个的,分别表示什么意思呢?

在C++中的#include<?>,<>里的?是有几个的,分别表示什么意思呢?
我要中文的讲解,谢谢

第1个回答  2006-06-19
好像没有见过几个的
一般都是

#include "file.ext"
或者
#include <file.ext>

The #include directive tells the preprocessor to treat the contents of a specified file as if those contents had appeared in the source program at the point where the directive appears.

#include "path-spec"
#include <path-spec>

Remarks
You can organize constant and macro definitions into include files and then use #include directives to add these definitions to any source file. Include files are also useful for incorporating declarations of external variables and complex data types. You need to define and name the types only once in an include file created for that purpose.

The path-spec is a filename optionally preceded by a directory specification. The filename must name an existing file. The syntax of the path-spec depends on the operating system on which the program is compiled.

For information on how to reference assemblies in a C++ application compiled with /clr, see #using.

Both syntax forms cause replacement of that directive by the entire contents of the specified include file. The difference between the two forms is the order in which the preprocessor searches for header files when the path is incompletely specified.

Syntax Form Action
Quoted form
This form instructs the preprocessor to look for include files in the same directory of the file that contains the #include statement, and then in the directories of any files that include (#include) that file. The preprocessor then searches along the path specified by the /I compiler option, then along paths specified by the INCLUDE environment variable.

Angle-bracket form
This form instructs the preprocessor to search for include files first along the path specified by the /I compiler option, then, when compiling from the command line, along the path specified by the INCLUDE environment variable.

The preprocessor stops searching as soon as it finds a file with the given name. If you specify a complete, unambiguous path specification for the include file between double quotation marks (" "), the preprocessor searches only that path specification and ignores the standard directories.

If the filename enclosed in double quotation marks is an incomplete path specification, the preprocessor first searches the "parent" file's directory. A parent file is the file containing the #include directive. For example, if you include a file named file2 within a file named file1, file1 is the parent file.

Include files can be "nested"; that is, an #include directive can appear in a file named by another #include directive. For example, file2, above, could include file3. In this case, file1 would still be the parent of file2 but would be the "grandparent" of file3.

When include files are nested and when compiling from the command line, directory searching begins with the directories of the parent file and then proceeds through the directories of any grandparent files. Thus, searching begins relative to the directory containing the source currently being processed. If the file is not found, the search moves to directories specified by the /I compiler option. Finally, the directories specified by the INCLUDE environment variable are searched.

From within the development environment, the INCLUDE environment variable is ignored. To set the directories searched for include files (this information also applies to the LIB environment variable.), see VC++ Directories, Projects, Options Dialog Box.

The following example shows file inclusion using angle brackets:

Copy Code
#include <stdio.h>

This example adds the contents of the file named STDIO.H to the source program. The angle brackets cause the preprocessor to search the directories specified by the INCLUDE environment variable for STDIO.H, after searching directories specified by the /I compiler option.

The following example shows file inclusion using the quoted form:

Copy Code
#include "defs.h"

This example adds the contents of the file specified by DEFS.H to the source program. The double quotation marks mean that the preprocessor searches the directory containing the parent source file first.

Nesting of include files can continue up to 10 levels. Once the nested #include is processed, the preprocessor continues to insert the enclosing include file into the original source file.

Microsoft Specific

To locate includable source files, the preprocessor first searches the directories specified by the /I compiler option. If the /I option is not present or fails, the preprocessor uses the INCLUDE environment variable to find any include files within angle brackets. The INCLUDE environment variable and /I compiler option can contain multiple paths separated by semicolons (;). If more than one directory appears as part of the /I option or within the INCLUDE environment variable, the preprocessor searches them in the order in which they appear.

For example, the command

Copy Code
CL /ID:\MSVC\INCLUDE MYPROG.C

causes the preprocessor to search the directory D:\MSVC\INCLUDE for include files such as STDIO.H. The commands

Copy Code
SET INCLUDE=D:\MSVC\INCLUDE
CL MYPROG.C

have the same effect. If both sets of searches fail, a fatal compiler error is generated.

If the filename is fully specified for an include file with a path that includes a colon (for example, F:\MSVC\SPECIAL\INCL\TEST.H), the preprocessor follows the path.

For include files specified as #include "path-spec", directory searching begins with the directory of the parent file and then proceeds through the directories of any grandparent files. Thus, searching begins relative to the directory containing the source file containing the #include directive being processed. If there is no grandparent file and the file has not been found, the search continues as if the filename were enclosed in angle brackets.

END Microsoft Specific

See Also
Reference
Preprocessor Directives

To make a suggestion or report a bug about Help or another feature of this product, go to the feedback site.

参考资料:MSDN FOR VS 2005

第2个回答  2006-06-19
#include <iostream.h>
或者
#include "iostream.h"
是一样的

其中iostream.h是一个头文件的文件名
比如你在abc.cpp这个文件中定一了一个类
而你在编写其他代码的时候,你也想用到这个类,那么只要在这个代码前加上一句
#include "abc.cpp"
那么你就可以使用这个类了

我们用的cin和cout都是已经定义好的类,就在<iostream>里

头文件相当多,有从c语言中保留下来的库,也有c++中的标准模版库

现在的C++标准是用#include <iostream>取代#include <iostream.h>,具体好处自己去查书吧
第3个回答  2006-06-19
这里边是头文件,有标准的头文件,也可以自己写,数量没法统计 多得很
不同的函数用到的头文件也可能不同
比如windows.h socket.h dos.h string.h
多得很
第4个回答  2006-06-20
想要多少有多少,你可以到
D:\Program Files\Microsoft Visual Studio\VC98\Include
目录下看看,所有.h的都可以本回答被提问者采纳

在C++中的#include<?>,<>里的?是有几个的,分别表示什么意思呢?
Include files can be "nested"; that is, an #include directive can appear in a file named by another #include directive. For example, file2, above, could include file3. In this case, file1 would still be the parent of file2 but would be the "grandparent" of file3.When ...

c++中的?是什么意思.还有:是啥
C++中,“?”与“:”共同组成三目条件运算符(?:)三目条件运算符(?:)使用例子如下:x ? y:z;上面的三目条件运算的规则是:先计算表达式x的值,若x为真,则整个三目运算的结果是表达式y的值;若x为假,则整个三目运算的结果是表达式z的值。下面的例子为从两个数中找出较大的程序:int a=3,...

一个C++程序是由哪几个部分构成的?其中的每一部分起什么作用?
1、头文件,每个程序都开头一堆#include,#define符号,#pragma编译开关 2、类型声明和全局变量,用于全局声明类、结构、枚举的定义,也可以设置全局变量 3、函数,即程序执行的具体过程、顺序、逻辑定义

C++里面的iostream是什么东西?
C++编译系统提供了用于输入输出的iostream类库。iostream这个单词是由3个部分组成的,即i-o-stream,意为输入输出流。在iostream类库中包含许多用于输入输出的类。ios是抽象基类,由他派生出istream类和ostream类,两个类名中第一个字母i和o分别代表输入(input)和输出(output)。isrream类支持输入操作,...

C++中的文件引用问题#include...
一般的形式是:ifnedf A define A endif 可以一个cpp文件对应一个.h文件 .h文件中包括了你这个cpp文件需要对外使用的函数 其他cpp如果需要用你的cpp中的函数 直接引入你所写的h就可以了 引用的顺序 实际上是无所谓的 .h文件中特别要注意 只写声明 不要定义 所以 你对c1.h的写法 是有一定...

#include的几个头文件含义
可以查 MSDN 或 C++ reference cstdlib 对应的是 C 中的 stdlib string 是字符串类 iomanip 是输入输出控制,设置输入输出格式 fstream 是文件流,用于读写文件

C或C++程序编译时内存分为几个存储区
在C++中,内存分成5个区,他们分别是堆、栈、自由存储区、全局\/静态存储区和常量存储区 1.栈,就是那些由编译器在需要的时候分配,在不需要的时候自动清楚的变量的存储区。里面的变量通常是局部变量、函数参数等。2.堆,就是那些由new分配的内存块,他们的释放编译器不去管,由我们的应用程序去控制...

C++里::是什么意思
"::"在C++中表示作用域,和所属关系。"::"是运算符中等级最高的,它分为三种,分别如下:一、作用域符号:作用域符号”::“的前面一般是类名称,后面一般是该类的成员名称,C++为例避免不同的类有名称相同的成员而采用作用域的方式进行区分。例如:A,B表示两个类,在A,B中都有成员member。那么...

c语言一开始是#符合,后面除了跟include还会跟什么?有几种呢?
这是预处理命令,即以#开头、以换行符结尾的行 常见的有:(1)宏定义 如:#define undef (2)文件包含 如:#include (3)条件编译 如:# if ifdef else elif endif (4)其他 如:#line error pragma

C++ 能不能在cin流中输入我指定的几个字符就换行
你这个小问题其实不是c++的范畴.是平台范畴.你输入abcdefghijklmnopqrstuvwxyz,是控制台在回显(echo)键盘缓冲区的内存,你可以用平台API把echo关掉,现在问题变成你要求键盘缓冲区有每当有5个字符,你的控制台要换行.方案一,你可以用SetWindowsHook( WH_KEYBOARD )来监视键盘缓冲区,每当有5个字符,钩子发送...

相似回答