#include 和 #include “filename.h” 有什么区别?

题目

#include 和 #include “filename.h” 有什么区别?

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

有以下程序:include include using namespace std;class base{private: cha

有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {

A.DerivedBase

B.BaseBase

C.DerivedDerived

D.BaseDerived


正确答案:A
解析:本题考核虚函数的应用。类Derived是从基类Base公有派生而来的。因此,Derived是基类Base的子类型。主函数中定义了一个基类对象bb和一个派生类对象dd。从程序中可看出,派生类Derived的对象dd交给了处理基类Base的对象的函数showPtr进行处理。由于在基类中函数myName被定义成虚函数,所以在函数showPtr中调用的myName函数为派生类的成员函数mySame,从而输出Derived。然后输出className,即基类名称Base。

第2题:

下列include命令中,正确的是()

A.#inclue[string.h]

B.#include{string.h}

C.#include(string.h)

D.#include


参考答案:D

第3题:

以下程序的执行结果是【】。 include include include int ma

以下程序的执行结果是【 】。

include <iostream.h>

include <fstream.h>

include <stdlib.h>

int main()

{

fstream outfile, infile;

outfile.open("D:\\text.dat",ios::out);

if(!outfile)

{

cout<<"text.dat can't open"<<end1


正确答案:1:1234567890/2:abcdfghij
1:1234567890/2:abcdfghij 解析:本题考核文件的I/O操作。先来了解eof()成员函数,该函数返回非0值表示已到文件结尾。程序首先定义fstream类的2个对象 outfile和infile。然后在文件text.dat写入两行字符串“1234567890”和“abcdefghii”。最后用getline()函数读取出来存入字符数组textline[40]中,并按行显示出来。程序中的两个if语句是用于打开文件失败的异常处理。

第4题:

在下列# include命令中,正确的一条是 ( )

A.# include [string.h]

B.# include {math.h}

C.# include(stdio.h)

D.# include<stdio.h>


正确答案:D

第5题:

指令元素中的include和动作元素中的include 有什么区别?


平常当利用程序中全部的页面的某些部分(例如题目、页脚和导航栏)都雷同的时候,我们就可以考虑用include。具体在哪些时候 用%@ include file=” ”%>,哪些时候用

 jsp:include page=” ” flush=”true”/.这种情势。首先要知道的是它们中间的区别。只有了解了它们用法的不同才 懂得该在何时去用以及怎么选择。

%@ include file=” ”%,jspinclude指令元素读入指定页面的内容。并把这些内容和本来的页面融合到一起。(这个过程是在翻译阶段:也就是jsp被转化成servlet的阶段

进行的。


第6题:

有以下程序:include include using namespace std;int main ( ){ ofstream

有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) { ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) { cin>>ch; ofile.put(ch);

A.程序编译时出错

B.abc#

C.abc

D.#


正确答案:C
解析:本题程序的功能是将从键盘终端输入的内容存储到指定的文件中。

第7题:

5:#include<filename.h>与@include"filename.h"的区别?


正确答案:
 

第8题:

有以下程序 include include int fun(int n) {int *

有以下程序 #include <stdio.h> #include <stdlib.h> int fun(int n) {int *p; p=(int*)malloc(sizeof(int)); *p=n; return *p; } { int a; a=fun(10); printf("%d\n",a+fun(10)); } 程序的运行结果是______。

A.0

B.10

C.20

D.出错


正确答案:C
解析:malloc(sizeof(int))的作用是开辟一个长度为sizeof(int)存储空间,并通过强制类型转换(int*)将此存储空间的地址赋给了—个整型的指针变量p。然后执行语句“*p=n”,使得*p的值为10,并通过返回此值,在主函数中输出a+10的值,即输出20。

第9题:

11 动态include()和静态include()的区别?


正确答案:
       

第10题:

简述include指令标识和〈jsp:include〉动作标识的差异。


正确答案: (1)inlcude指令通过file属性来确定被包含的页面,将file属性值看做一个实际存在的文件路径,所以该指令不支持任何表达式;〈jsp:include〉动作标识通过page属性确定被包含的页面,支持JSP表达式
(2)include指令包含的文件,内容会原封不动的插入到该指令的位置,与该指令合成进行编译,若改变了被包含文件,主文件要重新编译;〈jsp:include〉动作标识包含文件时,当该标识被执行时,程序会将请求转发到被包含的文件,并将执行结果输出到浏览器中,然后返回到包含文件继续执行后面的代码,JSP编译器对两个文件分别进行编译,被包含文件改动不会影响源文件。

更多相关问题