网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
有声明int fun14(int);int(?pf)(int)=fun14;在下列选项中,正确的调用是()
- A、int a=15;int n=fun14(&a);
- B、int a=15;cout<<(&pf)(a);
- C、cout<<(?pf)(256);
- D、cout<<?pf(256);
参考答案
更多 “有声明int fun14(int);int(?pf)(int)=fun14;在下列选项中,正确的调用是()A、int a=15;int n=fun14(a);B、int a=15;cout(pf)(a);C、cout(?pf)(256);D、cout?pf(256);” 相关考题
考题
设有以下函数void fun(int n,char * s) { …… }则下面对函数指针的定义和赋值均是正确的是A)void (*pf)(); pf=fun;B)viod *pf(); pf=fun;C)void *pf(); *pf=fun;D)void (*pf)(int,char);pf=fun;
考题
以下程序中,错误的行为①include ②class A③{④public:⑤int n=2;⑥A(int val){cout
以下程序中,错误的行为 ①#include < iostream.h > ②class A ③{ ④ public: ⑤ int n=2; ⑥ A(int val){cout << val<<end1;} ⑦ ~A( 0{}; ⑧}; ⑨void main( 0 ⑩{ (11) Aa(0); (12)A.⑤B.⑥C.⑦D.(11)
考题
下面程序的运行结果是#includeint fun(int a[]. int n){int result=l:for(int i=1;iresult=result*a[i];return result;}void main(){int a[3]={3,4,5};cout}A.12;B.15;C.20;D.60
考题
下面程序的运行结果为 include Class Astatic int n; public: A( ) {n=1;} A(int n
下面程序的运行结果为#include<iostream.h>Class Astatic int n;public:A( ) {n=1;}A(int num) {n=num;}void print( ) {cout < < n;}};int A: :n=2;void main( ){A a,b(3) ;a. print( ) ;b. print( ) ;cout < < endl;}A.11B.13C.23D.33
考题
有如下程序:includeusing namespace std;class Base{int x;public:Base(int n=0):x(n
有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;} int getX( )const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m),Base(n){tout<<m;} Derived(int m):y(m){cout<<m;} }; int main( ){ Derived dl(3),d2(5,7); return 0; } 程序的输出结果是A.375B.357C.0375D.0357
考题
c++,运行下面代码出错
#include iostreamusing namespace std;struct student_info{ string name; int chinese; int math; int english;};student_info student[5];void inputinfo(){ int i = 0; char a[20]; for(i = 0;i 5;i++) { cout"enter the "i+1" student's information "endl; cout"enter the name"endl; cina; student[i].name = a; cout"enter chinese performance :"endl; cinstudent[i].chinese; cout"enter math performance :"endl; cinstudent[i].math; cout"enter english performance :"endl; cinstudent[i].english; }}void outputinfo(){ int i = 0; while(i 5) { couti+1" student's information"endl; coutstudent[i].name.c_str()endl; cout"chinese "endl; coutstudent[i].chineseendl; cout"math "endl; coutstudent[i].mathendl; cout"english "endl; coutstudent[i].englishendl; i++; }}int avgfunction(int arr[],int n){ int i = 0; int total = 0; for(i = 0;i n;i++) { total += arr[i]; } return total / n;}void computavg() //这里是否正确?{ int theavg = 0; theavg = avgfunction(student[i].chinese,5); }int main(){ inputinfo(); outputinfo(); computavg(); cin.get(); return 0;} 帮我找出错误 然后改过来 择优为满意答案 不分先后
考题
请编写一个函数void fun(int p[],int n,int c),其中数组p的元素按由小到大的顺序排列,其元素个数为n。函数fun()的功能是将c插入到数组p中,且保持数组的升序排列。注意:部分源程序已存在文件PROC9.cpp中。请勿修改主函数和其他函数中的任何内容,仅在函数fun()的花括号中填写若干语句;文件PROC9.cpp的内容如下://PROC9.cppinclude <iostream>include <string>using namespace std;define M 30void fun(int p[ ],int n,int c);int main (){int pp[M],n,i;int fg, c;cout<<"Please input n:\n";cin>>n;cout<<"Please input the n data:\n";for (i=0; i<n; i++)cin>>pp [i];cout<<"Please input c:\n";cin>>c;fun (pp, n, c);for (i=0; i<n; i++)cout<<pp [i] << " " ;cout<<end1;return 0;}void fun(int p[ ],int n, int c){//* * * * * * * * *}
考题
使用VC6打开考生文件夹下的工程test29_1,此工程包含一个源程序文件test29_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:A:no parametersB:int parameterA:no parametersB:int parameterC:int parameter源程序文件test29_1.cpp清单如下;include <iostream.h>class A{/***************** found *****************/private:A(){ cout<<"A:no parameters\n";}A(int a) {cout<<"A: int parameter\n";}};class B:public A{public:B(int a){cout<<"B:int Parameter\n";}};/***************** found *****************/class C:public B,public A{public:/***************** found *****************/C(int a) ::B(a) {cout<<"C: int parameter\n"; )};void main ( ){B b(1);C c(2);}
考题
阅读以下说明和C++程序,将应填入(n)处的字句写在对应栏内。[说明]下面程序输出一个矩形面积,以及矩形区域上的假想的作物产量。[C++程序]include <iostream.h>class crop_assessment{int actual_crop;int ideal_crop;public:void set(int in_actual,int in_ideal){actual crop=in_actual;ideal_crop=in_ideal;}int get_actual_crop(void){ (1) ;}int get_ideal_crop(void){ (2) ;)};Class lot_size{int length;int width;(3) crop;public:void set(int 1,int w,int a,int i){length=1;width=w;crop.set(a,i);}int get_area(void){return length*width;}int get_data(void){return (4) ;}int get_data2(void)freturn (5) ;}}int main(){Los_size small,medium;small.set(5,5,5,25);medium.set(10,10,10,50);cout<<"For a small lot of area"<<smallget_area()<<“\n”;cout<<"the actual crops are$"<<small.get_data2()<<"\n";cout<<"and ideal crops are$”<<small.get_data()<<"\n";cout<<"For a medium Lot of area"<<medium.get area()<<:\n”;cout<<"the actual crops are$"<<medium.get_data2()<<"\n";cout<<"and ideal crops are$"<<medium.get_data()<<"\n";return 0;}
考题
以下程序的输出结果是_____。 include class object {private:int val; public:objec
以下程序的输出结果是_____。include<iostream.h>class object{ private:int val;public:object( ) ;object(int i) ;~object( ) ;};object: :object( ){ val=0;cout < < "Default constructor for object" < < endl;}object: :object(int i){ val=i;cout < < "Constructor for object" < < val < < endl;}object: :~object( ){ cout < < "Destructor for object" < < val < < endl;}class container{ private:object one;object two;int data;public:container( ) ;container(int i,int j,int k) ;~container( ) ;};container: :container( ){ data=0;cout < < "Default constructor for container" < < endl;}container: :container(int i,int j,int k) :two(i) ,one(j){ data=k;cout < < "Constructor for container" < < endl;}container: :~container( ){ cout < < "Destructor for container" < < endl;}void main( ){ container anObj(5,6,10) ;}
考题
设有以下函数: void fun(int n,char*s){…} 则下面对函数指针的定义和赋值均正确的是( )。A.void(*pf)( );pf=fun;B.void*pf( );pf=funC.void*pf( );*pf=fun;D.void(*pf)(int,char);pf=fun;
考题
给出以下程序的执行结果【】。 include using namespace std; int n=1; void Fun(); int
给出以下程序的执行结果【 】。include <iostream>using namespace std;int n=1;void Fun();int main (){n++;Fun ( );if (n>0){int n=5;cout<<"Block: n="<<n<< ", ";}cout<< "Main: n="<<end1;return 0;}void Fun ( ){int n=10;cout<<"Fun: n="<<n<<",";}
考题
有以下程序:includeusing namespace std;int f(int x);int sum(int n){ int x,s=0; f
有以下程序: #include<iostream> using namespace std; int f(int x); int sum(int n) { int x,s=0; for(x = 0;x<=n;x++) s+=f(x); return s; } int f(int x) { return (x*x+1); } int main() { int a,b; cout<<"Enter a integer number:"; cin>>a; b=sum(a) ; cout<<a<<","<<b<<end1; return 0; } 如果输入数字3,其输出结果是( )。A.3,12B.3,16C.3,18D.4,20
考题
有如下程序: include using namespace std; class Base{ int x; pu
有如下程序: #include<iostream> using namespace std; class Base{ int x; public: Base(int n=0):x(n){cout<<n;) int getX()const{return x;} }; class Derived:public Base{ int y; public: Derived(int m,int n):y(m,)Base(n){cout<<m;} Derived(int m):y(m){cout<<m;} }; int main(){ Derived d1(3),d2(5,7) return 0; }运行时的输出结果是A.375B.357C.375D.357
考题
设有以下函数:void fun(int n,char*$s){……}则下面对函数指针的定义和赋值均正确的是A.void(*pf)( );pf=fun;B.void*Pf( );pf=fun;C.void*pf( ); *pf=fun;D.void(*pf)(int,char);nf=fun;
考题
下面程序的输出结果是【】。 include int d=1; int fun(int p){ static int d=5; d+=p;
下面程序的输出结果是【 】。include<iostream.h>int d=1;int fun(int p){static int d=5;d+=p;cout<<d<<" ";return d;}void main(){int a:3;cout<<fun(a+fun(D) )<<end1;}
考题
假定n=3,,下列程序的运行结果是()。includeint Fun(int m)void main(){cout
假定n=3,,下列程序的运行结果是( )。 #include<iostream.h> int Fun(int m) void main() { cout<<"Please input a number:"; int n,s=0; cin>>n; s=Fun(n); cout<<s<<endl; } int Fun(int m) { iht p=1,s=0; for (int I=1;I<=m;I++) { p*=I; S+=p; } return s; }A.7B.9C.8D.10
考题
设有以下函数:voidfun(intn,char}s){……}则下面对函数指针的定义和赋值均正确的是( )。A.void(*pf)(int,char);pf=fun;B.void+pf( );pf=fun;C.void*pf( );*pf=fun;D.void(*pf)(int,char*);pf=fun;
考题
有以下程序:include using namespace std;void fun(int i,int j){ cout
有以下程序: #include <iostream> using namespace std; void fun(int i,int j) { cout<<(i+j)<<end1; } void fun(int i) { cout<<i++<<end1; } int main() { int a=1; fun(A) ; return 0; } 该程序执行后的输出结果是( )。A.1B.2C.3D.4
考题
下列函数的运行结果是()。includeint add(int a,int b);void main(){extem int x,y;
下列函数的运行结果是( )。 #include<iostream.h> int add(int a,int b); void main() { extem int x,y; cout<<add(x,y)<<endl; } int x(20),y(5); int add(int a,int b) { int s=a+b; return s; )A.25B.30C.20D.15
考题
以下程序中,错误的行为①include②class A③{④public:⑤int n=2;⑥A(int val){cout
以下程序中,错误的行为①#include<iostream.h> ②class A ③{ ④ public: ⑤ int n=2; ⑥ A(int val){cout<<val<<end1;} ⑦ ~A(){}; ⑧}; ⑨void main() ⑩{ (11) A a(0); (12)}A.⑤B.⑥C.⑦D.(11)
考题
下面程序的运行结果是include int fun ( int a[ ],int n){int result=1;for(int
下面程序的运行结果是 #include < iostream.h > int fun ( int a[ ],int n) { int result=1; for(int i=1;i<n;i++) result=result*a[i]; return result; } void main( ) { int a[3]={3,4,5}; cout << fun(a,A.12B.15C.20D.60
考题
假定a=3,下列程序的运行结果是()。includeint fun(int n);void main(){cout
假定a=3,下列程序的运行结果是( )。 #include<iostream.h> int fun(int n); void main() { cout<<"Please input a number:"; int a,result=0; cin>>a; result=fun(a); cout<<result<<end1; } int fun(int n) { int p=1,result=0; for(int i=1;i<=n;i++) { p*=i; result +=p; } return result; }A.4B.8C.9D.20
考题
有以下程序:includeusing namespace std;int main(){int n=100;cout
有以下程序: #include<iostream> using namespace std; int main(){ int n=100; cout<<dec<<n<<","; cout<<oct<<n<<","; cout<<hex<<n<<endl; return 0; } 程序运行后输出的结果是( )。A.100,100,100B.64,144,100C.100,144,64D.100,64,144
考题
有函数原型void fun8(int);在下列选项中,正确的调用是()A、int a=2.17;fun8(a);B、int a=15;fun8(a?3.14);C、int b=100;fun8(b);D、fun8(256);
考题
单选题设有以下函数:void fun(int n,char* s){……}则下面对函数指针的定义和赋值均是正确的是( )。A
void(*pf)();pf=fun;B
void * pf();pf=fun;C
void * pf();* pf=fun;D
void(* pf)(int,char);pf=fun;
考题
单选题有声明int fun14(int);int(?pf)(int)=fun14;在下列选项中,正确的调用是()A
int a=15;int n=fun14(a);B
int a=15;cout(pf)(a);C
cout(?pf)(256);D
cout?pf(256);
热门标签
最新试卷