更多"阅读以下程序# include<fstream. h>void mai"的相关试题:
[单项选择]阅读以下程序
# include<fstream. h>
void main( )ifstream infile;
ofstream outfile;
stream iofile;
iofile. open("a. txt", ios:: in);
iofile. close( );
iofile. open('b. txt" ,ios: :out):
....下列描述错误的是
A. 对象infile只能用于文件输入操作
B. 对象outfile只能用于文件输出操作
C. 对象iofile在文件关闭后,不能再打开另一个文件
D. 对象iofile可以打开一个文件同时进行输入和输出
[单项选择]阅读以下程序
#include<iostream.h>
void main( )
charline[10];
in>>line;
cout<<line<<endl;
如运行时输入This is an example.<CR>,则程序的输出结果是( )。
A. This
B. This is
C. This is a
D. This is an example.
[单项选择]若有以下程序段:
void x(int n);
void main( )
void x(int n);
x(5);
void x(int n)
cout<<n:
则以下叙述不正确的是 ______。
A. 若只在子函数中对函数x进行声明,则只能在主数中正确调用函数x
B. 若只在子函数前面对函数x进行声明,则其后的所有函数中都可以正确调用函数x
C. 对于以上程序,编译时系统会提示出错信息:提示对x函数重复声明
D. 函数x无返回值,所以可用void定义x的函数类型
[单项选择]阅读下面程序
public static void main (String[] args)
System.out.printIn (34+56-6);
System.out.printIn (26*2-3);
System.out.printIn (3*4/2);
System.out.printIn (5/2);
程序运行结果是______。
A. 84
B. 90
C. 84
D. 68
[单项选择]有以下程序
#include<iostream.h>
void main( )
int a=5,b=0,c=0;
if(a=b+c)cout<<"***"<<endl:
else cout<<"$$$"<<<endl;
下列选项叙述正确的是( )。
A. 有语法错不能通过编译
B. 可以通过编译但不能通过连接
C. 输出***
D. 输出$$$
[单项选择]有以下程序
#include<stdio.h>
void main( )
int n=2,k=1;
while(!(k>0||n++));
printf("%d %d/n",k,n);
程序运行后的输出结果是( )。
A. 0 2
B. 1 3
C. 5 7
D. 1 2
[单项选择]有以下程序
#include"iostream.h"
void main( )
inti=l,j=1,k=2;
if ((j++k++)&&i++)
cout<< i << " ," << j << "," << k;
cout<<endl;
执行后输出结果是
A. 1,1,2
B. 2,2,1
C. 2,2,2
D. 2,2,3
[单项选择]有以下程序 #include<iostream.h> void main( ) { int a=5,b=0,c=0; if(a=b+c) cout<<"* * *" <<endl; else cout<<"$$$"<<endl;} 下列选项叙述正确的是
A. 有语法错不能通过编译
B. 可以通过编译但不能通过连接
C. 输出* * *
D. 输出 $ $ $
[单项选择]有以下程序:
#include<iostresm.h>
void main( )
int n;
cin>>n;
if (n++<10)
cout<<n<<endl;
else
cout<<n--<<endl;
若执行上述程序时,从键盘上输入9,则输出结果是( )。
A. 11
B. 10
C. 9
D. 8