题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-11 02:33:27

[填空题]main函数中发生编译错误的语句是______。
#include<iostream.h>
class A

public:
int a;
const int b;
A( ):a(10),b(20)
void fun( )const

cout<<"a="<<a<<"/tb="<<b<<endl;

;
void main( )

A obj1;
const A*ptr=new A;
ptr=&obj1;
ptr->a=100;
ptr->fun( );

更多"main函数中发生编译错误的语句是______。 #include<"的相关试题:

[填空题]main函数中发生编译错误的语句是 【12】 。 # include <iostream. h> class A { public: int a; const int b: A( ) :a(10) ,b(20) { void fun( ) const { cout<<"a="<<a<<"/tb="<<b<<end1; } }; void main( ) A obj1; const A * ptr = new A: ptr = &obj1; ptr->a=lO0; ptr->fun( ), }
[填空题]main函数中发生编译错误的语句是______。 #include<iostream.h> class A { public: int a; const int b; A( ):a(10),b(20){} void fun( )const { cout<<"a="<<a<<"/tb="<<b<<endl; } }; void main( ) { A obj1; const A*ptr=new A; ptr=&obj1; ptr->a=100; ptr->fun( ); }
[填空题]如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为 【8】 。 # include<iostream.h> class test { private: int num; public: test(int) void show( ); }; test: :test(int n){ num=n;} test:: show( ) { cout<<num<<end1; } void main( ) { test T(10); T. show ( ); }
[填空题]如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为 【8】
# include<iostream.h>
class testprivate:
int num;
public:
test(int)
void show( );
;
test: :test(int n) num=n;
test:: show( ) cout<<num<<end1;
void main( ) test T(10);
T. show ( );

[填空题]如下程序编译时发生错误,错误的原因是show函数实现语句错误,则正确的语句应该为______。
#include<iostream.h>
class test

private:
int hum;
public:
test(int);
void show( );
;
test::test(int n)num=n;
test::show( )cout<<num<<endl;
void main( )

test T(10):
T.show( );

[填空题]完成下列类的构造函数,初始化语句为______。
#include<iostream.h>
class Test

private:
int x,y;
public:
void Test(int initx,int inity)
______

void printx( )cout<<x<<"-"<<y<<"="<<x-y;
;
void main( )

Test x(300,200);
x.printx( );

[单项选择]若有如下语句   #include   void main( )   {   int x=3;   do{   x=x-2;   cout<<x;   }while(!(--x));   }   则上面程序段
A. 输出的是1
B. 输出的是1和-2
C. 输出的是3和0
D. 是死循环
[单项选择]函数的值通过rerurn语句返回,下面关于return语句的形式描述错误的是
A. return表达式;
B. return(表达式);
C. 一个return语句可以返回多个函数值
D. 一个return语句只能返回一个函数值
[填空题]

以下程序运行后的输出结果是()。
#include
#include
#include
main( )
{ char *p;int i;
p=(char*)malloc(sizeof(char)*20);
strcpy(p,"welcome");
for(i=6;i>=0;i--) putchar(*(p+i));
printf("/n"); free(p);
}


[填空题]参照函数模板的写法,完成非模板函数的定义,语句为 【12】
#include<iostream, h>
#include<string. h>
template<class T>
T min(T a, T b)

return(a<b a:b);

char * min(char * a, char * b)

__________________________

void main( )

double a=1.23,b=3.45;
char s1[]="abcd",s2[]="erg";
cout<<min(a, b)<<min(s1,s2)<<end1:

[填空题]参照函数模板的写法,完成非模板函数的定义,语句为 【12】 。 #include<iostream, h> #include<string. h> template<class T> T min(T a, T b) { return(a<b a:b); } char * min(char * a, char * b) { __________________________ } void main( ) { double a=1.23,b=3.45; char s1[]="abcd",s2[]="erg"; cout<<min(a, b)<<min(s1,s2)<<end1: }
[填空题]类class one 在声明func 成员函数时发生错误,出错原因是 【9】 。 Class one { private: int a; public: void func(two& ) }; class two { private: int b; friend void one: :func(two & ); }; void one: : func(two& r) a=r.b; }
[填空题]参照函数模板的写法,完成非模板函数的定义,语句为______。 #include<iostream.h) #include(string.h> template(class T) T min(T a,T b) { return(a<ba:b); } char*min(char*a,char*b) { } void main( ) { double a=1.23,b=3.45; chars1[]=”abcd”,s2[]=”efg”; cout<<min(a,b)<<rain(s1,s2)<(endl; }
[填空题]参照函数模板的写法,完成非模板函数的定义,语句为______。
#include<iostream.h>
#include<string.h>
template<class T>
T min(T a,T b)

return(a<b a:b);

char*rain(char*a,char*b) ______

void main( )

double a=1.23,b=3.45;
char s1[]="abed",s2[]="efg";
cout<<min(a,b)<<min(s1,s2)<<endl;

[单项选择]若函数中有定义语句:int k;,则______。
A. 系统将自动给k赋初值0
B. 这时k中的值无定义
C. 系统将自动给k赋初值-1
D. 这时k中无任何值
[单项选择]有以下程序 #include main( ) {FILE *fp; int i; char ch[]="abcd",t; fp=fopen("abc.dat", "wb+"); for(i=0;i<4;i++)fwrite(&ch[i],1,1,fp); fseek(fp,-2L,SEEK_END); fread(&,1,1,fp); fclose(fp); printf("%c\n",t); } 程序执行后的输出结果是【 】。
A. d
B. c
C. b
D. a

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码