下面程序错误的语句是
①#include<iostream.h>
②void main()
③{
④ int * p=new int[1]
⑤ p=9
⑥ cout<<* p<<end1;
⑦ delete []p;
⑧}
A.④
B.⑤
C.⑥
D.⑦
第1题:
下面程序错误的语句是
①#include
②void main()
③{
④int*p=new int[1];
⑤p=9;
⑥cout <<*p<
⑦delete[]p
⑧}
A.④
B.⑤
C.⑥
D.⑦
第2题:
下面程序的功能是输出数组s中最小元素,请填空。
include<iostream.h>
void main(){
int k, p, s[]={1,-9,7,2,-10,3};
k=s[0];
for(p=0;p<6;p++)
if(s[p]<k) 【 】;
cout<<k;
}
第3题:
下面程序错误的语句是 ①#include < iostream.h> ②void main( 0 ③{ ④ int * p = new int[1] ; ⑤ p =9; ⑥ cout <<*p <<end1; ⑦ delete [ ] p; ⑧ }
A.④
B.⑤
C.⑥
D.⑦
第4题:
以下程序的输出结果是【 】。
include<iostream. h>
void main() {
int *p;
p=new int;
*p=200;
cout<<*p;
delete p;
}
第5题:
下面程序的运行结果是【 】。
include<iostream.h>
void main()
{
char s[]="9876",*p;
for(p=s;p<s+2;p++)
cout<<p;
}
第6题:
下面程序运行时输出结果为______。
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;
}
第7题:
下面程序的输出结果是【 】。
include <iostream>
using namespace std;
int d=1;
fun(int p){
static int d = 5;
d+ =p;
cout<<d;
return (d) ;
}
void main ( ) {
int a =3;
cout<<fun ( a + fun (d) )<<endl;
}
第8题:
下面程序错误的语句是
① #include<iostream.h>
② void main( )
③ {
④ int * p=new int[1] ;
⑤ p=9;
⑥ cout < < * p < <endl;
⑦ delete[ ] p;
⑧ }
A.④
B.⑤
C.⑥
D.⑦
第9题:
下面程序运行时输出结果为【 】。
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;
}
第10题:
下面程序执行的结果是【 】。
include <iostream>
using namespace std;
void main(){
int sum=0;
int array[6]={1,2,3,4,5,6};
int *p;
p=&array[0];
for(int i=0;i<6;i++){
sum=sum+*p;
p++;
}
cout<<sum;
}