更多"下面程序运行时输出结果为______。 #include <iost"的相关试题:
[填空题]下列程序的输出结果是______。
#include <iostream>
#include <cstring>
using namespace std;
void fun(const char*S,char &C) {e=s[strlen(s)/2];}
int main( ){
char str[ ]="ABCDE";
char ch=str[1];
fun(str,ch);
cout<<ch;
return 0;
}
[填空题]下面程序运行时输出结果为:
C:/Program Files is a directory.
请将程序补充完整。
import java.io*;
public class DirTest
public static void mian (String[]args)
File myDir=new File ("C:/Program Files/");
System.out.printIn (myDir+(______.isDirectory( )"is": "is not")+"a directory.");
[填空题]以下程序运行后的输出结果是 【16】 。
#include <stdio, h>
#include <stating, h>
void fun(char * s,int p,int k)
{ int i;
for(i=p;i<k-1;i++) s[i] =s[i+2];
}
main( )
{ char s [] = "abedefg";
fun(s,3 ,strlen(s) ); puts(s);
}
[填空题]以下程序执行后输出的结果是 【15】 。
#include<iostream>
#include<fstream>
using namespace std;
int main( ){
ofstream ofile("D://temp.txt");
if(!ofile){
cout<<"temp.txt cannot open"<<endl;
return 0;
}
ofile<<"This is a book" <<" " <<54321<<endl;
ofile.close( );
ifstream ifile("D://temp.txt");
if(!ifile){
cout<<"temp.txt cannot open" <<endl;
return 0;
}
charstr[40];
ifile >> str;
ifile.close( );
cout<<Str<<endl;
return 1;
}
[填空题]下面程序运行时输出的结果为
C:/Program Files is a directory.
将程序补充完整。
Import java.io.*;
public class DirTest {
public static void main(String[] args) {
File myDir=Flew File("C:/Program Files/");
System.out.println(myDir+(______.isDirectory( )"is":"is not")+"a directory.");
}
}
[填空题]下面程序运行时输出结果为 【8】 。
#include<iostream.h>
#include<malloc.h>
class Rect
{
public:
Rect(int1,int w)(length=1;width=w;)
void Print( ){cout<<"Area:"<<length *width<<endl;)
void *operator new(size-t size){return malloc(size);}
void operator delete(void *p){free(p)
private:
int length,width;
};
void main( )
{
Rect*p;
p=new Rect(5,4);
p->Print( );
delete p;
}
[填空题]下面程序运行时输出的结果为
C:/Program Files is a directory.
将程序补充完整。
Import java.io.*;
public class DirTest
public static void main(String[] args)
File myDir=Flew File("C:/Program Files/");
System.out.println(myDir+(______.isDirectory( )"is":"is not")+"a directory.");
[填空题]下面程序运行时输出结果为 【8】 。
#include<iostream.h>
#include<malloc.h>
class Rect
public:
Rect(int1,int w)(length=1;width=w;)
void Print( )cout<<"Area:"<<length *width<<endl;)
void *operator new(size-t size)return malloc(size);
void operator delete(void *p)free(p)
private:
int length,width;
;
void main( )
Rect*p;
p=new Rect(5,4);
p->Print( );
delete p;
[填空题]下面程序运行时输出结果为______。
#include<iostream.h>
#include
class Rect
{
public:
Rect(int l, int w){length=l; width=w;)
void Print( ){cout<<"Area:"<<length*width<<end1;}
void operator delete(void*p){free(p);}
private:
int length, width;
};
void main( )
{
Rect *p;
p=new Rect(5, 4);
p->Print( );
delete p;
}
[填空题]下面程序运行时输出结果为______。
#include<iostream.h>
#include
class Rect
public:
Rect(int l, int w)length=l; width=w;)
void Print( )cout<<"Area:"<<length*width<<end1;
void operator delete(void*p)free(p);
private:
int length, width;
;
void main( )
Rect *p;
p=new Rect(5, 4);
p->Print( );
delete p;
[填空题]若下面程序运行时输出结果为:
1,A,10.1
2,B,3.5
请将程序补充完整。
#include<iostream>
using namespace std;
int main( )
{
void test(int, char,double______);
test(1, ’A’, 10.1);
test(2, ’B’);
return 0;
}
void test(int a, char b, double c)
{
cout<<a<<’,’<<b<<’,’<<c<<end1;
}
[填空题]若下面程序运行时输出结果为:
1,A,10.1
2,B,3.5
请将程序补充完整。
#include<iostream>
using namespace std;
int main( )
void test(int, char,double______);
test(1, ’A’, 10.1);
test(2, ’B’);
return 0;
void test(int a, char b, double c)
cout<<a<<’,’<<b<<’,’<<c<<end1;
[简答题]给出下面程序输出结果。
#include<iostream.h>
class Base
private:
int Y;
public:
Base(int y=0)y=y;cout<<"Base("<<y<<")/n";
~Base( )cout<<"~Base( )/n";
void print( )cout<<Y<<" ";
;
class Derived:public Base
private:
int Z;
public:
Derived(int y,int z):Base(y)
Z=z;
cout<<"Derived("<<y<<","<<z<<")/n";
~Derived( )cout<<"~Derived( )/n";
void print( )
Base::print( );
cout<<Z<<endl;
;
void main( )
Derived d(10,20);
d.print( );
[单项选择]给出下面程序输出结果。
#include<iostream.h>
void main( )
int *p1;
int**p2=&p1;
int b=20;
p1=&b;
cout<<**p2<<endl;