网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
int x=1,y=2; int *p1,*p2; p1=&x;p2=&y; 下面与x=y;不等价的语句是()
A.*p1=*p2;
B.*p1=y;
C.x=*p2;
D.p1=p2;
参考答案和解析
C
更多 “int x=1,y=2; int *p1,*p2; p1=x;p2=y; 下面与x=y;不等价的语句是()A.*p1=*p2;B.*p1=y;C.x=*p2;D.p1=p2;” 相关考题
考题
下面结构体的定义语句中,错误的是A)struct ord {int x;int y;int z;}; struct ord a;B)struct ord {int x;int y;int z;} struct ord a;C)struct ord {int x;int y;int z;} a;D)struct {int x;int y;int z;} a;
考题
单击命令按钮时,下列程序的执行结果为Private Sub Command1_Click()Dim a As Integer, b As Integer, c As Integera=2: b=3: c=4Print P2(c, b, A.End SubPrivate Function P1(x As Integer, y As Integer, z As Integer)P1=2 * x + y + 3 * zEnd FunctionPrivate Function P2(x As Integer, y As Integer, z As Integer)P2=P1(z, x, y) + xEnd Function ( )。A.21B.19C.17D.34
考题
( 29 )有如下程序:#includeiostreamusing namespace std;class Part{public:Part(int x=0):val(x) {coutval;}~Part(){coutval;}private:int val;};class Whole{public:Whole(int x ,int y, int z=0):p2(x),p1(y),val(z){coutval;}~Whole(){coutval;}private:Part p1,p2;int val;};int main(){Whole obj(1,2,3);return 0;}程序的输出结果是A ) 123321B ) 213312C ) 213D ) 123123
考题
有如下程序: include using namespace std; class Part{ public:
有如下程序: #include <iostream> using namespace std; class Part{ public: Part(int x=0):val(x) { cout<<val; } ~Part() { cout<<val; } private: int val; }; class Whole { public: Whole(int x, int y, int z=0):p2(x),p1 (y),val(z) { cout<<val; } ~whole() { cout<<val; private: Part p1,p2; int val; }; int main() { Whole obj (1,2,3); return 0; }程序的输出结果是A.123321B.213312C.213D.123123
考题
下面程序的输出结果是【】。include include class point{double x; double y;
下面程序的输出结果是【 】。include <iostream.h>include <math.h>class point{double x;double y;public:point(double a, double b){x=a;y=b;}friend double distance(point a, point b) ;};double distance(point a, point b){return sqrt ((a. x-b.x) * (a. x-b.x)+ (a. y-b. y) * (a. y-b. y) );}void main(){point p1(1,2);point p2(5,2);cout<<distance(p1,p2)<<end1;}
考题
下面结构体的定义语句中,错误的是( )。 A.struct ord{int x;int Y;int Z;};struet ord a;SXB
下面结构体的定义语句中,错误的是( )。A.struct ord{int x;int Y;int Z;};struet ord a;B.struct ord{int x;int y;int Z;}struct ord a;C.struct ord{int X;int Y;int Z;}a;D.struct{int X;int y;int Z;}a;
考题
单击命令按钮时,下列程序的执行结果为 Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer a=2:b=3:C=4 Print P2(c,b,A)End Sub Private Function P1(x As Integer,y As Integer,z As Integer) P1=2 * X + y + 3 * z End Function Private Function P2(x As Integer,y As Integer,z As Integer) P2=P1(z,x,y) + X End FunctionA.21B.19C.17D.34
考题
下面程序的输出结果是【】。 inclde include using namespace std; class point {
下面程序的输出结果是【 】。inclde<iostreamn>include<math>using namespace std;class point{private:double x;double y;public:point(double a,double b){x=a;y=b;}friend double distance(point a,point b);};double distance(point a,point b){return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}int main(){point p1(1,2);point p2(5,2);cout<<distalice(p1,p2)<<endl;return 0;}
考题
下列程序执行后,屏幕的输出是()。includeusing namespace std;void swap(int x,int y)
下列程序执行后,屏幕的输出是( )。 #include<iostream> using namespace std; void swap(int x,int y) { int temp=x; x=y; y=temp; cout<<"x="<<x<<"",y=""<<y<<end1; } int main() { int x=3,y=2; swap(x,y); cout<<"x="<<x<<",y="<<y<<end1; return 0; }A.x=3,y=2 x=3,y=2B.x=2,y=3 x=3,y=2C.x=2,y=3 x=2,y=3D. x=3,y=2 x=2,y=3
考题
有如下程序:includeusing namespace std;class Part{public:Part(int x=0):val(x){co
有如下程序: #include<iostream> using namespace std; class Part{ public: Part(int x=0):val(x){cout ~Part( ){cout<<val;} pritave: int val; }; class Whole{ public: Whole(int x,int Y,int z=0):p2(x),p1(Y),val(z){cout<<val;} ~Whole( ){cout<<val;} pritave: Part p1,p2; int val; f; int main( ){ Whole obj(1,2,3); return 0; } 程序的输出结果是A.123321B.213312C.213D.123123
考题
有如下程序:#includeiostream#includecmathusing std::cout;class Point{public:friend double distance(const Point p); //P距原点的距离Point(int xx=0,int yy=0):x(xx),Y(YY){}//①private:int x,y;};double distance(const Point p){ //②return sqrt(P.x*P.x+P.y*P.y);}int main(){Point p1(3,4);coutdistance(p1);return 0; //③}下列叙述中正确的是A.程序编译正确B.程序编译时语句①出错C.程序编译时语句②出错D.程序编译时语句③出错
考题
下面程序的输出结果是()。includeincludeusing namespace std;class point{p
下面程序的输出结果是( )。 #include<iostream> #include<math.h> using namespace std; class point { private: double x; double y; public: point(double a,double b) { x=a; y=b; } friend double distances(point a,point b); }; double distances(point a,point b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } int main() { point p1(1,2); point p2(5,2); cout<<distances(p1,p2)<<end1; return 0; }A.2B.4C.8D.16
考题
分析下面的程序 main() { int*p1,*p2,*p; int x=4,y=6; p1=x;p2=y; if(x<y) {p=p1;p1=p2;p2=p; } printf("%d,%d,",*p1,*p2); printf("%d,%d\n",x,y); } 程序的输出结果为_______。A.6,4,4,6B.4,6,6,4C.4,6,4,6D.6,4,6,4
考题
有如下程序:include using namespace std;class point{int x, y;public:point( int v
有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point( int vx, int vy ) { X=vx; y=vy; } point() { x=0; y=0; } point operator+ ( point p1 ) { point p; int px = x + p1.x; int py = y+ p1.y; return point( px, py ); } point operator-( point p1 { point p; int px = x - p1.x; int py = y - p1.y; return point( px, py ); } void print() { cout<<x<<","<<y<<end1; }};int main(){ point p1( 10, 10 ), p2( 20, 20 ); p1 = p1 + p2; p1.print(); return ();}执行后的输出结果是( )。A.10, 10B.20, 20C.10, 20D.30, 30
考题
以下程序运行后,单击命令按钮,窗体显示的结果是 ______。 Private Function p1(x As Integer,y As Integel,z As Integer) p1=2*x+y+3*z End Function Private Function p2(x As Integer,y As Integer,z As Integer) p2=p1(2,y,x)+x End Function Private SubCommandl_Click() Dim a As Integer Dim b As Integer Dim c As Integer a=2:b=3:c=4 Print p2(c,b,A)End SubA.19B.21C.22D.23
考题
有如下程序:include using namespace std;class point{intx,y;public:point( int vx,
有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point( int vx, int vy ) { x = vx; y = vy; } point ( ) x = 0; y= 0; } point operator+( point p1 ) { point p; int px = x+ p1.x; int py = y + p1.y; return point( px, py ); point operator-( point p1 ) { point p; int px = x -p1.x; int py = y - p1.y; return point ( px, py ); } void print() { cout<<x<<" , "<<y<<end1; }};int main (){ point p1(10, 10 ), p2( 20, 20 ); p1 = p1 - p2; p1.print (); return 0;} 执行后的输出结果是A.10,10B.20,20C.10,20D.30,30
考题
窗体上有两个文本框Text1、Text2以及一个命令按钮Command1,编写下列程序: Dim y As IntegerPrivate Sub Command1_Click()Dim x As Integer x=2 Text1.Text=p2(p1(x), y) Text2.Text=pi(x)End SubPrivate Function p1(x As Integer) As Integer x=x+y:y=x+y p1=x+yEnd FunctionPrivate Function p2(x As Integer, y As Integer) As Integer p2=2*x+yEnd Function 当单击1次和单击2次命令按钮后,文本框Text1和Text2内的值分别为( )。A.2 4 2 4B.2 4 4 8C.4 4 8 8D.10 10 58 58
考题
请教:2016年计算机二级C++基础练习二简答题2如何解答?
有以下两个程序,分析它们的执行结果有什么不同。程序1:#includeclass Point{int x,y;public:Point(){x=y=0;}Point(int i,int j){x=i;y=j;}Point operator+(Point);void disp() ( cout”(”}Point Point::operator+(Point P){this-x+=P.x; this-y+=p.y;return *this;}void main(){Point pl(2,3),p2(3,4),p3;cout”p1:”;p1.disp();cout”p2:”;p2.disp();p3=pl+p2;cout”执行p3=p1+p2后”cout”p1:”,p1.disp();cout”p2:”;p2.disp();cout”p3:”;p3.disp();}程序2:#includeclass Point{int x,Y;public:Point(){x=y=O;}Point(int i,int j){x=i,y=j;}Point operator+(Point);void disp f){cout ”(”}Point Point::operator+(Point P){Point s;s.x=x+p.x; s.y=y+p.y;return s;}void main(){Point pl(2,3),p2(3,4),p3;cout”p1:”;p1.disp();cout”p2:”;p2.disp();p3=pl+p2;cout”执行p3=p1+p2后”cout”p1:”;p1.disp();cout”p2:”;p2.disp();cout”p3:”;p3.disp();}
考题
窗体上有两个文本框Text1、Text2以及一个命令按钮Command1,编写下列程序: DimY As Integer Private Sub Command1 Click( ) Dim X As Integer x=2 Text1.Text=p2(p1(X),Y) Text2.Text=p1(x) End Sub Private Function p1(X As Integer)As Integer x+x+v: y=x+y p1=x+y End Function Private Function p2(X As Integer,Y As Integer)As Integer p2=2*x+y End Function 当单击1次和单击2次命令按钮后,文本框Text1和Text2内的值分别为( )。A.2 4 2 4B.2 4 4 8C.4 4 8 8D.10 10 58 58
考题
有如下程序: include using namespace std; class point {int x,y; public:point( i
有如下程序: #include <iostream> using namespace std; class point { int x, y; public: point( int vx, int vy ) { x = vx; y = vy; } point ( ) { x = 0; y = 0; } point operator+( point pl ) { point p; int px = x + p1.x; int py = y + p1.y; return point( px, py ); } point operator-( point p1 ) { point p; int px = x - p1.x; int py = y - p1.y; return point( px, py ); } void print() { cout<<x<<", "<<y<<end1; } }; int main () { point pl ( 10, 10 ), p2 ( 20, 20 ); p1 = p1 + p2; p1.print (); return 0; } 执行后的输出结果是( )。A.10,10B.20,20C.10,20D.30,30
考题
有如下程序:includeusing namespace std;class point{int x,y;public:point(int vx,i
有如下程序: #include<iostream> using namespace std; class point { int x,y; public: point(int vx,int vy) { x=vx; y=vy; } point() { x=0; y=0; } point operator+(point p1) { point p; int px=x+p1.x; int py=y+p1.y; return point(px,py); } point operator-(point p1) { point p; int px=x-p1.x; int py=y-p1.y; return point(px,py); } void print() { cout<<x<<","<<y<<end1; } }; int main() { point p1(10,10),p2(20,20); p1=p1+p2; p1.print(); retrun 0; } 执行后的输出结果是A.10,10B.20,20C.10,20D.30,30
考题
窗体上有两个文本框Text1、Text2以及一个命令按钮Comanand1,编写下列程序: Dim y As Integer Private Sub Command1_Click() Dim x As Integer x=2 Text1.Text = p2(p1(x), y) Text2.Text = p1(x) End Sub Private Function p1(x As Integer) As Integer x=x+y:y=x+y p1=x+y End Function Private Function p2(x As Integer, y As Integer) As Integer p2=2*x+y End Function 当单击1次和单击2次命令按钮后,文本框Text1和Text2内的值分别为( )。A.2 4 2 4B.2 4 4 8C.4 4 8 8D.10 10 58 58
考题
设X~N(μ,42),Y~N(μ,52),p1=P{X≤μ-4},p2=P{Y≥μ+5},则()A、对任意实数,都有p1=p2B、对任意实数,都有p12C、对任意实数,都有p1p2D、对任意实数,都有p1≠p2
考题
有以下变量说明,下面不正确的赋值语句是() int a=5, b=10,c; int ?p1=a,?p2=b;A、?p2=b;B、p1=a;C、p2=p1;D、c=?p1?(?p2)。
考题
在下面C语言的函数说明语句中,正确的是()。A、int fun(int x, int y);B、int fun(int x,y);C、int fun(x,y);D、int fun(int x; int y);
考题
单选题有以下变量说明,下面不正确的赋值语句是() int a=5, b=10,c; int ?p1=a,?p2=b;A
?p2=b;B
p1=a;C
p2=p1;D
c=?p1?(?p2)。
考题
单选题在下面C语言的函数说明语句中,正确的是()。A
int fun(int x, int y);B
int fun(int x,y);C
int fun(x,y);D
int fun(int x; int y);
热门标签
最新试卷