网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
有以下程序:void swap (char *x,char *y){char t; t=*x,*x=*y;*y=t;}main(){char* s1="abc",*s2="123"; swap(s1,s2); printf("%s,%s\n",s1,s2);}程序执行后的输出结果是( )。
A.123,abc
B.abc,123
C.1bc,a23
D.321,cba
参考答案
更多 “ 有以下程序:void swap (char *x,char *y){char t; t=*x,*x=*y;*y=t;}main(){char* s1="abc",*s2="123"; swap(s1,s2); printf("%s,%s\n",s1,s2);}程序执行后的输出结果是( )。A.123,abcB.abc,123C.1bc,a23D.321,cba ” 相关考题
考题
若有定义 :char *x="abcdefghi"; ,以下选项中正确运用了 strcpy 函数的是A)char y[10]; strcpy(y,x[4]);B)char y[10]; strcpy(++y,x[1]);C)char y[10],*s; strcpy(s=y+5,x);D)char y[10],*s; strcpy(s=y+1,x+1);
考题
●有以下C程序:char fun(char x,char y){if(x)return y;}main(){int a=′9′,b=′8′,c=′7′;printf("%c/n",fun(fun(a,b),fun(b,c)));}程序的执行结果是 (31) 。(31) A.函数调用出错B.8C.9D.7
考题
有以下程序void swap(char *x,char *y){ char t;t=*x; *x=*y; *y=t;}main(){ char *s1="abc",*s2="123";swap(s1,s2);printf(" % s, % s\n",s1,s2);}程序执行后的输出结果是A)123,abcB)abc,123C)1bc,a23D)321,cba
考题
若有定义:char *x="abcdefghi";,以下选项中正确运用了strcpy函数的是______。A.char y[10]; strcpy(y,x[4]);B.char y[10]; strcpy(++y,x[1]);C.char y[10],*s; strcpy(s=y+5,x);D.char y[10],*s; strcpy(s=y+1,x+1);
考题
有以下程序: char fun(char x,char y) { if(x<y) return x; return y; } main() { int a='9',b='8',c='7'; printf("%c\n",fun(fun(a,b),fun(b,c)); } 程序的执行结果是( )。A.函数调用出错B.8C.9D.7
考题
下面的程序执行后,屏幕上显示的应是 public class Exam{ public static void main(String[]args){ char char1[]={'t','e','s','t'}; char char2[]={'t','e','S','t','1'}; String s1=new String(char1); String s2=new String(char2,0,4); System.out.println(s1.equals(s2)); } }A.trueB.falseC.testD.编译错误
考题
阅读下列程序说明和c代码,将应填入(n)处的字句写在对应栏内。[说明]下面的程序利用递归算法计算x和y的最大公约数。[函数2.1]main ( ){ int x,y,k,t;scanf(" % d% d" , x, y);if(x>y) { t=x;x=y; y=t;}(1);while(k! =0){y=x;(2);k=y%x;}prinff( "% d" ,x); }[函数2.2说明]函数fun(char *str,char *substr的功能是计算子串sugbstr在串str中出现的次数。[函数2.2]fun(ehar * str, char * substr){ int x,y,z;(3);for(x=0;str[ x] ! = '\O';x + + )for(y=x,z=0;sabstr[z] = =str[y];(4),y+ +)if((5)= ='\0') {num + +;break;}return(num);}
考题
有以下程序并includeincludefun(char * w,int n){char t,*s1,*s2; s1=w;s2=
有以下程序 并include<stdio.h> #include<string.h> fun(char * w,int n) { char t,*s1,*s2; s1=w; s2=w+n-1; while(s1<s2) { t=*s1++; * s1=*s2--; * s2=t; } } main() { char p[]="1234567"; fun(p,strlen(p)); puts(p); } 程序运行后的输出结果是( )A.1234567B.7654321C.1711717D.7177171
考题
有以下程序: include using namespace std; char *x[]={"First", "Second", "Third"
有以下程序: #include <iostream> using namespace std; char *x[]={"First", "Second", "Third" }; void f(char *z[ ]) { cout<<*z++<<end1; } int main ( ) { char **y; y=x; f(y); return 0; }A.产生语法错误B.FirstC.SecpndD.Third
考题
有以下程序: void swap(char*x,char*y) {cbar t; t=*x; *x=*y; *y=t; } main() {char*s1="abc",*s2="123"; swap(s1,s2);printf("%s,%s\n",s1,s2); } 程序执行后的输出结果是( )。A.123,abcB.abc,123C.1bc,a23D.321,cba
考题
有以下程序: void swap(char*x,char*y) { char t; t=*x;*x=*y;*y=t; } main { char*s1="abe",*s2="123": swap(s1,s2); printf("%s,%s\n",s1,s2); } 程序执行后的输出结果是( )。A.123,abeB.abc.123C.1bc,a23D.321,cba
考题
阅读下面程序: include void fun1(char a,char b) { char c; c=a;a=b;b=c; } void f
阅读下面程序:include<iostream.h>void fun1(char a,char b){char c;c=a;a=b;b=c;}void fun2(chara,charb){char c;c=a;a=b;b=c;}void main(){char a,b;a='x';b='y';fun1(a,b);cout<<a<<b;a='x';b='y';fun2(a,b);cout<<a<<b;}则该程序的输出为______。
考题
以下程序运行后的输出结果是______。includeinclude usingnamespacestd;classY
以下程序运行后的输出结果是______。include <iostream>include <string>using namespace std;class Y;class X{int x;char *strx;public:X(int a, char *str){x=a;strx=new char[strlen(str)+1]strcpy (strx,str);}void show(Y ob);};class Y{prlvate:int y;char *stry;public:Y(int b,char *str){y=b;stry=new char[strlen(str)+1];strcpy(stry,str);}friend void X::show(Y ob);};void X::show{Y ob){cout<<strx<<",",cout<<ob.stry<<endl;}int main{{X a (10, "stringX");Y b (20, "stringY");a. show (b);renurn 0;}
考题
以下程序的输出结果是_______。includemain(){char*a="abcdefghi";int k;fun(a) ;puts
以下程序的输出结果是_______。 #include<string.h> main() {char*a="abcdefghi";int k; fun(a) ;puts(a) ; } fun(char *s) { int x,y; char c; for(x=0,y=strlen(s)-1; x<y; x++,y--) { c=s[y]; s[y]=s[x];s[x]=c;} }A.ihgfedcbaB.abcdefghiC.abcdedcbaD.ihgfefghi
考题
以下4个程序中,不能实现两个实参值进行交换的是 ( )。A.void swap (float *p, float *q) { float *t ,a; t = a; t = p; *p = *q; *q = *t; } void main () { float x = 8.0;y = 9.0; swap (x, y); cout<<x<<", "<<y<<B.void swap (float *p, float *q) { float a; a = *p; *p = *q; *q = a; } void main() { float x = 8.0;y = 9.0; swap (x, y); cout<<x<<", "<<y<<end1;C.void swap (float *p, float *q) { float x; x = *p; *p = *q; *q = x; } void main() { float a,b.; *a = 8.0;*b = 9.0; swap (a, b) ;D.void swap (float p, float q) { float a; a = p; p = q; q = a; } void main() { float a = 8.0,b = 9.0; swap (a,b); cout<<x<<", "<<y<<
考题
下列程序的输出结果是______。#includemain(){ char *a="abcdefghi";int k; fun(a);puts(a);}fun(char*s){ int x,y;char c; for(x=0,y=strlen(s)-1;x<y;x++,y--) { c=s[y];s[y]=s[x];s[x]=c;}}A.ihgfsdcbaB.abcdcfghiC.abcdedebaD.ihgfefghi
考题
下面程序输出的结果是()。includeusing namespace std;int fuc (char *x);int main(){
下面程序输出的结果是( )。 #include<iostream> using namespace std; int fuc (char *x); int main(){ cout<<fuc("hello")<<endl; return 0; } int fuc(char *x){ char *y=x; while(*y! ='\0')y++; return(y-x); }A.5B.6C.0D.语法错误,不能输出结果
考题
有以下程序:include include using namespace std;class Y;class X{private
有以下程序: #include <iostream> #include <string> using namespace std; class Y; class X { private: int x; char *strx; public: X(int a, char *str) { x=a; strx=new char[strlen(str)+1]; strcpy(strx,str); } void show(Y ob) ; }; class Y { private: int y; char *stry; public: Y(int b,char *str) { y=b; stry=new char[strlen(str)+1]; strcpy(stry, str); } friend void X: :show(Y ob) ; }; void X: :show(Y ob) { cout<<strx<<", "; cout<<ob, stry<<end1; } int main ( ) { X a(10,"X"); Y b (20, "Y"); a. show(B) ; return 0; } 执行后的输出结果是( )。A.X,YB.a,bC.X,XD.Y,Y
考题
有以下程序,程序运行的结果是 ______。includeincludevoid main(){charx
有以下程序,程序运行的结果是 ______。 #include<iostream.h> #include<string.h> void main(){ char x[]= "C++" ,y[10]= "C++" ; cout<<sizeof(x)/sizeof(char)<<“,”<<sizeof(y)/sizeof(char); }A.3 3B.4 4C.4 10D.10 10
考题
有以下程序:include char fun(char x,char y){if(x
有以下程序: #include <stdio.h> char fun(char x,char y) { if(x<y) return x; return y; } main() { int a='9',b='8',c='7'; printf("%c\n",fun(fun(a,b),fun(b,c))); } 程序的执行结果是( )。A.函数调用出错B.8C.9D.7
考题
有以下程序:include void swap(char * x,ehar * y){ char t;t= *x; *x: *y; *y=t;main
有以下程序:#include <stdio.h>void swap(char * x,ehar * y){ char t; t= *x; *x: *y; *y=t;main ( ){ char *s1 ="abc", * s2 ="123"; swap(s1 ,s2); printf("%s,%s \n" ,s1 ,s2);}程序执行后的输出结果是( )。A.123,abeB.abe,123C.1bc,a23D.321,cba
考题
有以下C程序:char fun(char x, char y){ if(x)return y;main(){ int a ='9', b ='8', c ='7';printf("% c/n", fun(fun(a,b), fun(b,c)));程序的执行结果是(31)。A.函数调用出错B.8C.9D.7
考题
以下程序的输出结果是______。 include main() { char*a="abcdefghi";int k fun(a);p
以下程序的输出结果是______。 #include <string.h> main() { char*a="abcdefghi";int k fun(a);puts(a); } fun(char*s) { int x,y; char c for(x=0,y=strlen(s)-1;x<y:x++,y--) {c=s[y];s[y]=s[x];s[x]=c;} }A.ihgfedcbaB.abcdefghiC.abcdedebaD.ihgfefghi
考题
有以下程序 char fun(char x,char y) { if(x<y)return x; return y; } main() { int a='9',b='8',c=''; printf("%c\n",fun(fun(a,b) ,fun(b,c) )); } 程序的执行结果是A.函数调用出错B.8C.9D.7
考题
有以下程序 void swap(Char *x,Char *y) {Char t; t=*x;*x=*y;*y=t; } main( ) {Char *s1=”abc”,*s2=”123”; swap(sl,s2); printf(”%s,%s/n”,s1,s2); } 程序执行后的输出结果是()A、abe,123B、123,abcC、321,cbaD、1bc,a23
考题
单选题有以下程序 void swap(Char *x,Char *y) {Char t; t=*x;*x=*y;*y=t; } main( ) {Char *s1=”abc”,*s2=”123”; swap(sl,s2); printf(”%s,%s/n”,s1,s2); } 程序执行后的输出结果是()A
abe,123B
123,abcC
321,cbaD
1bc,a23
考题
单选题有以下程序 char fun(char x,char y) { if(x y) return x; return y; } main() { int a=’9’,b=’8’,c=’7’; printf("%c/n",fun(fun(a,b),fun(b,c))); } 程序的执行结果是()A
函数调用出错B
8C
9D
7
考题
单选题有以下程序
#include
voidswap(char*x,char*y)
{
chart;
t=*x;
*x=*y;
*y=t;
}
main()
{
char*s1,*s2;
chara[]=abc;
charb[]=123;
s1=a;
s2=b;
swap(s1,s2);
printf(%s,%s,s1,s2);
}
程序执行后的输出结果是( )。A
1bc,a23B
abc,123C
123,abcD
321,cba
热门标签
最新试卷