单选题若已有以下定义和语句: #include int x=4,y=3,*p,*q,*s; p=x; q=y; s=q; q=NULL; 则下面分别给出的四条语句中,错误的是()A*q=0;Bs=p;C*p=x;D*p=*s;
单选题
若已有以下定义和语句: #include int x=4,y=3,*p,*q,*s; p=&x; q=&y; s=q; q=NULL; 则下面分别给出的四条语句中,错误的是()
A
*q=0;
B
s=p;
C
*p=x;
D
*p=*s;
参考解析
解析:
暂无解析
相关考题:
请将以下程序中的函数声明语句补充完整。#include stdio.hint 【 1 2 】 ;main(){ int x,y,(*p)();scanf("%d%d",x,y);p=max;printf("%d\n",(*p)(x,y));}int max(int a,int b){ return(ab?a:b);}
有以下程序:void f(int *x,int *y){ int *t; t=x; x=y ;y=t; *x=*y;}main(){ int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=a[7]; while(pq) { f(p,q);p++;q--} for(i=0;i8;i++)printf("d,",a[i]);}程序运行后的输出结果是( )。A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,
(26)有以下程序#include stdio.hvoid fun( int *a,int *b){int *c;c=a;a=b;b=c;}main(){int x=3,y-5,*P=x,*q=y;fun(p,q);printf(“%d,%d,”,*p,*q);fun(x,y);printf(“%d,%d\n”,*p,*q);}程序运行后的输出结果是A)3,5,5,3 B)3,5,3,5 C)5,3,3,5 D)5,3,5,3
下列程序的输出结果是( )。 void f(int*x,int*y) {int t; t=*x,*x=*y;*y=t; } main() {int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=a[7]; while(p<q) {f(p,q);p++;q--;} for(i=0;i<8;i+)printf("%d,",a[i]); }A.8,2,3,4,5,6,7,1B.5,6,7,8,1,2,3,4C.1,2,3,4,5,6,7,8D.8,7,6,5,4,3,2,1
若有一些定义和语句 include int a=4,b=3,*p,*q,*w; p=a; q=b; w=q; q 若有一些定义和语句 #include <stdio.h> int a=4,b=3,*p,*q,*w; p=a; q=b; w=q; q=NULL; 则以下选项中错误的语句是A.*q=0;B.w=p;C.*p=va;D.*p=*w;
有以下程序 int *f(int *x,int *y) { if(*x<*y) return x; else return y; } main( ) { int a=7,b=8,*p,*q,*r; p=a; q=b; r=f(p,q); printf("%d,%d,%d\n",*p,*q,*r); } 执行后输出结果是A.7,8,8B.7,8,7C.8,7,7D.8,7,8
有以下程序intā*f(int*x,int*y){ if(*x<*y)return x;elsereturn y;}main( ){ int a=7,b=8,*p,*q,*r;p=a;q=b;r=f(p,q);cout<<*p<<","<<*q<<","<<*r<<endl;}执行后输出结果是A.7,8,8B.7,8,7C.8,7,7D.8,7,8
以下程序的输出结果是 【11】 。int fun(int x,int y,int *p,int *q){ *p=x*y;*q=x/y;}main(){int a,b,c,d;a=4;b=3;fun(a,b,c,d);printf("%d,%d\n",c,d);}
阅读以下说明和C++码,将相应的文字填入(n)处,写在对应栏内。[说明]以下代码实现了对象引用作为函数参数,仔细阅读以下代码,分析运行结果,填入(n)处。[代码]include<iostream.h>class Sample{int x,y;public:Sample() {x=y=0; }Sample (int i, int j ) {x=i; y=j; }void copy ( Sample s ).,void setxy ( int i, int j ) {x=i; y=j; }void print ( {cout<<"x="<<x<<end1 ; cout <<"y="<<y<<end1;};void Sample: copy ( Sample s ){X=S.X;y=s.y;}void func ( Sample s1, Sample s2 ){s1.setxy ( 10,20 );s2.setxy ( 30,40 );}void main ( ){Sample p ( 1,2 ) ,q;q.copy ( p );time ( p,q );p.print ( );q.print ( );}运行结果(1)(2)(3)(4)
有以下程序:int *flint *x, int *y){ if(*x<*y) return x; else return y;}main(){ int a=7,b=8,*p,*q,*r; p=a; q=b; r=f(p, q); printf("%d, %d, %d\n",*p,*q,*r);}执行后输出结果是( )。A.7,8,8B.7,8,7C.8,7,7D.8,7,8
若有以下定义和语句:includeinta=4,b=3,*p,*q,*w;p=a; q=b; w=q; q=NULL;则 若有以下定义和语句: #include<stdio.h> int a=4,b=3,*p,*q,*w; p=a; q=b; w=q; q=NULL; 则以下选项中错误的语句是( )。A.*q=0;B.w=p;C.*p=a;D.*p=*w;
有以下程序 include void fun(int*a,int*B) { int*c; c=a;a=b;b=c; } main() {int x=3 有以下程序 #include<stdio.h> void fun(int*a,int*B) { int*c; c=a;a=b;b=c; } main() { int x=3, y=5,*p=x, *q=y; fun(p,q); printf("%d,%d,",*p,*q); fun(x,y); printf(" %d,%d\n",*p,*q); } 程序运行后的输出结果是______。A.3,5,5,3B.3,5,3,5C.5,3,3,5D.5,3,5,3
有以下程序 void f(int *x,int *y) { int t; t=*X; *X=*y; *y=t; } main() { int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a; q=a[7); while(p>q) { f(p,q); p++; q--; } for(i=0; i<8; i++) printf("%d,",a[i]); } 程序运行后的输出结果是A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,
有以下程序: void f(int*x,int*y) { int t; t=*x;*x=*y;*y=t; } main() { int a [8]={1, 2,3,4,5, 6, 7,8},i,*p,*q; p=a;q=a[7]; while(p<q) {f(p,q);p++;q-;} for(i=0;i<8;i++)printf("%d,"a[i]); } 程序运行后的输出结果是 ______。A.823,4,5,6,7,1,B.5,6,7,8,12,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,
有以下程序*f(int * x,int * y) { if( * x< * y) return x; else return y; } main() { int a=7.b=8, * p, * q, * r; p=a; q=b: r=f(p,q); coat<< * p<<","<< * q<<","<< * r<<end1; } 执行后输出结果是A.7,8,8B.7.8,7C.8,7,7D.8.7,8
下面程序的运行结果是void swap(int *a,int *b){ int *t; t=a;a=b;b=t;}main(){ int x=3,y=5,*p=x,*q=y; swap(p,q); printf("%d%d\n",*p,*q);}
以下程序的输出结果是include "stdio.h"int *f(int *x,int *y){ if(*x*y) return x; else return y;}main(){ int a=7,b=8, *p,*q,*r ; p=a; q=b; r= f(p,q); printf("%d,%d,%d\n",*p,*q,*r);}
若有一些定义和语句include inta=4, b=3, *p,*q,*w;p=a;q=b;w=q;q=NULL;则 若有一些定义和语句 #include <stdio.h> int a=4, b=3, *p,*q,*w; p=a; q=b; w=q; q=NULL; 则以下选项中错误的语句是A.*q=0;B.w=p;C.*p=a;D.*p=*w;
有以下程序 void f(int*x,int*y) { int t; t=*x;*x=*y;*y=t; } main() { int a[8]={1,2,3,4,5,6,7,8},i,*p,*q; p=a;q=a[7]; while(p { f(p,q);p++; q--; } for (i=0;i<8;i++)printf("%d,",a[i]); } 程序运行后的输出结果是______。A.8,2,3,4,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,
执行以下程序后的输出结果为( )。includeclass Sample{int x, y;public:Sample() { 执行以下程序后的输出结果为( )。#include<iostream. b>class Sample{ int x, y; public: Sample() { x=y=0;} Sample(int a, int b) {x=a; y=b; } void disp () { cout<<"x="<<x<<"y="<<y<<end1; }};void main(){ Sample s(2,3), *p=s; p->disp();}A.x=1, y=3B.x=2, y=4C.x=3, y=2D.x=2, y=3
设有以下C语言说明语句。 struct { int x,y;} s[2]={{1,2),{3,4}),*p=s,*q=s; 则表达式++p->x和表达式(++q)->x的值分别为(34)。A.1、1B.1、3C.2、3D.3、3
有以下程序:include void f(int * x,int * y) int t;t= *x; *x= *y; *y=t;main ( ){in 有以下程序:#include <stdio.h>void f(int * x,int * y) int t; t= *x; *x= *y; *y=t;main ( ){ int a[8] = { 1,2,3,4,5,6,7,8} ,i, * p, * q; p=a;q =a[7]; while(p<q) { f(p,q) ;p ++ ;q --; } for(i =0;i<8;i ++ ) printf(" % d," ,a[i]); }程序运行后的输出结果是( )。A.8,2,3,4.,5,6,7,1,B.5,6,7,8,1,2,3,4,C.1,2,3,4,5,6,7,8,D.8,7,6,5,4,3,2,1,
有以下程序:includeincludeusingnamespacestd;classDistance;classpoint{pub 有以下程序: #include <iostream> #include <cmath> using namespace std; class Distance; class point { public: friend class Distance; Point(int a,int B) { x=a; Y=b; } void Print() { cout<<"X= "<<X<<end1; cout<<"Y= "<<Y<<end1; } private: float X,Y; }; class Distance { public: float Dis(Point p,Point q); }; float Distance :: Dis(Point p,Point q) { float result; result=sqrt((p.X-q.X)*(p.X-q.X)+(p.Y-q.Y)*(p.Y-q.Y)); cout<<result<<end1; retUrn result; } int main() { Point p(10,10),q(10,30); Distance d; d.Dis(p,q); return 0; } 运行后的输出结果是( )。A.10B.30C.0D.20
下面程序和运行运行结果是【 】。void swap(int * a,int * b){ int * t;t=a; a=b; b=t;}main( ){ intx=3,y=5,* p=&x,* q=&y;swap(p,q);prinff("%d %d\n", *p, *q);}
若已有以下定义和语句: #include int x=4,y=3,*p,*q,*s; p=x; q=y; s=q; q=NULL; 则下面分别给出的四条语句中,错误的是()A、*q=0;B、s=p;C、*p=x;D、*p=*s;
单选题以下选项中,不能对主函数中变量i和j的值进行交换的程序是( )。A#include stdio.hvoid swap(int *p, int *q){ int *t; *t = *p; *p = *q; *q = *t;}main(){ int i=10, j=20,*a=i,*b=j; swap(a,b); printf(i=%d j=%d,i,j);}B#include stdio.hvoid swap(int *p, int *q){ int t; t = *p; *p = *q; *q = t;}main(){ int i=10,j=20,*a=i,*b=j; swap(a,b); printf(i=%d j=%d,i,j);}C#include stdio.h#include stdlib.hvoid swap(int *p, int *q){ int *t; t = (int *)malloc(sizeof(int)); *t = *p; *p = *q; *q = *t; free(t);}main(){ int i=10,j=20; swap(i,j); printf(i=%d j=%d,i,j);}D#include stdio.hvoid swap( int *p, int *q){ int t; t = *p; *p = *q; *q = t;}main(){ int i=10,j=20,*x=i,*y=j; swap(x,y); printf(i=%d j=%d,i,j);}
单选题有以下程序:#include void fun(int*a,int*b){ int*c; c=a; a=b; b=c;}main(){ int x=3,y=5,*p=x,*q=y; fun(p,q); printf(%d,%d,*p,*q); fun(x,y); printf(%d,%d,*p,*q);}程序运行后的输出结果是( )。A3,5,5,3B3,5,3,5C5,3,3,5D5,3,5,3