有以下程序int add (int a,int b){return (a+b); }main(){ int k,(*f)(),a=5,b=10;f=add;…}则以下函数调用语句错误的是
A.k=(*f)(a,b);
B.k=add(a,b);
C.k=*f(a,b);
D.k=f(a,b);
A.k=(*f)(a,b);
B.k=add(a,b);
C.k=*f(a,b);
D.k=f(a,b);
第1题
有以下程序
int add(int a,int b){ return (a+b); }
main()
{ int k, (*f)(), a=5,b=10;
f=add;
…
}
则以下函数调用语句错误的是
A)k=(*f)(a,b);
B)k=add(a,b);
C)k= *f(a,b);
D)k=f(a,b);
第2题
有以下程序: int add(int a,intB){return(a+B);} main() { int k,(*f)(),a=5,b=10; f=add; } 则以下函数调用语句错误的是()。
A.k=(*f)(a,B);
B.k=add(a,B);
C.k=*f(a,B);
D.k=f(a,B);
第3题
A.k=(*f)(a,b);
B.k=add(a,b);
C.k=*f(a,b);
D.k=f(a,b);
第4题
A.k=(*f)(a,b);
B.k=add(a,b);
C.k=*f(a,b);
D.k=f(a,b);
第5题
有以下程序: #include <iostream> using namespace std; int s=0; class sample { static int n; public: sample (int i) { n=i; } static void add() { s+=n; } }; int sample::n=0;
A.2
B.5
C.7
D.3
第6题
有以下程序: #include<iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } sample add(sample s1,sample s2) { this->n=s1.n+s2.n; return(*this); }
A.n=10
B.n=5
C.n=20
D.n=15
第7题
有以下程序: #include <iostream> using namespace std; template < class T > class TAdd { private: T x, y; public: TAdd(T a, T b ) { x = a; y = b; } T add() { return x + y; } }; int main () { TAdd < int > A(5, 6 ); TAdd< double > B(2.4, 5.6 ); cout<<A, add () <<", "<<B. add () <<end1; return 0; } 执行后的输出结果是()。
A.11,8
B.5,6
C.2.4,5.6
D.8,11
第8题
有以下程序: #include<iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; sample add(sample s1,sample s2) { this->n=s1.n+s2.n; return (*this); void disp() cout<<"n="<<n<<end1; } int main() sample s1(10),s2(5),s3; s3.add(s1,s2); s3.disp(); return 0; 程序运行后,输出的结果是
A.n=10
B.n=5
C.n=20
D.n=15
第9题
有以下程序: #include <iostream> using namespace std; class sample { private: int n: public: sample () {} sample(int m) { n=m; } sample add(sample s1, sample s2) this->n=s1.n+s2.n; return (*this); } void disp () { cout <<"n="<<n<<end1; } }; int main() sample s1(1)0,s2(5),s3; s3.add(s1,s2); s3.disp(); return 0; } 程序运行后,输出的结果是
A.n=10
B.n=5
C.n=20
D.n=15
第10题
以下程序的输出结果是______。
include<iostream.h>
int add(int x, int y)
{
return x+y;
}
double add(double x, double y)
{
return x+y;
}
void main()
{
int a=3, b=3;
double c=6.5, d=1.5;
cout<<add(a, b)<<","<<add(c, d)<<end1;
}
为了保护您的账号安全,请在“赏学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!