网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

下面函数的功能是 。 void (char *s1, char *s2) { while(*s2++==*s1++); }

A.字符串反向

B.字符串比较

C.字符串连接

D.字符串复制


参考答案和解析
A
更多 “下面函数的功能是 。 void (char *s1, char *s2) { while(*s2++==*s1++); }A.字符串反向B.字符串比较C.字符串连接D.字符串复制” 相关考题
考题 有以下程序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

考题 以下程序的输出结果是______# includemain(){char *s1,*s2,m;s1=s2=(char*)malloc(sizeof(char));*s1=15;*s2=20;m=*s1+*s2;printf(“%d\n”,m);}

考题 下面程序的输出结果是( )。#include "string.h"fun(char*w,int n){ char t,*s1,*s2;s1=w; s2=w+n-1;while(s1s2){ t=*s1++;*s1=*s2--;*s2=t;}}main(){ static char p[]="1234567";fun(p,strlen(p));printf("%s",p);}A.7654321 B.1717171 C.7171717 D.1711717

考题 编写一个函数fun(),它的功能是:实现两个字符串的连接(不使用库函数strcat,即把p2所指的字符串连接到p1所指的字符串后。例如,分别输入下面两个字符串:FirstStringSecondString则程序输出:FirstStringSecondString注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号小填入所编写的若干语句。试题程序:include <stdio. h>include<conio. h>void fun (char pi[],char p2[]){}main ( ){char s1[80],s2[40];clrscr ();printf("Enter s1 and s2:\n");scanf ("%s%s", s1, s2);printf ("s1=%s\n", s1);printf("s2=%s\n",s2);printf("Invoke fun(s1,s2) :\n");fun(s1,s2);printf("After invoking:\n");printf ("%s\n", s1);}

考题 ( 12 )请将下面的程序补充完整,使得程序输出 “ 飘是张娜的书 ” 。#include iostreamusing namespace std;class Book{public:Book(char *str) {strcpy(title,str);}【 12 】 void PrintInfo() {couttitleendl;}protected:char title[50];};class MyBook:public Book{public:MyBook(char *s1,char *s2= " 张娜 " ):【 13 】 {strcpy(owner,s2);}virtual void PrintInfo() {couttitle " 是 " owner " 的书 " endl;}private:char owner[10];};int main(){Book *prt=new MyBook( " 飘 " );prt-PrintInfo();return 0;}

考题 下面的程序执行后,屏幕上显示的应是 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.编译错误

考题 有以下程序并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

考题 以下程序的输出结果是______。includeincludefun(char*w,int n){ char t,*s 以下程序的输出结果是______。 #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; p="1234567"; fun(p,strlen(p)); puts(p); }A.1234567B.7654321C.1711717D.7177171

考题 请读程序:includeincludemain(){char *s1="AbCdEf",*s2="aB"; s1++;s2++; 请读程序: #include<stdio.h> #include<string.h> main() { char *s1="AbCdEf",*s2="aB"; s1++;s2++; printf("%d\n",strcmp(s1,s2)); } 上面程序的输出结果是______。A.正数B.负数C.零D.不确定的值

考题 有以下程序: 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

考题 下面程序的运行结果是()。includeincludemain(){char*s1="abDuj";char*s2=" 下面程序的运行结果是( )。 #include<stdio.h> #include<string.h> main() {char*s1="abDuj"; char*s2="ABdUG"; int t; t=strcmp(s1,s2); printf("%d",t); }A.正数B.负数C.零D.不确定的值

考题 下面的程序执行后,屏幕上应显示______。 public class Test{ 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.编译错误

考题 阅读以下函数: fun(char*s1, char*s2) { int i=0; while(s1[i]==s2[i] s2[i]!='\0') i++; return(s1[i]== s2{i)!=='\0'); } 此函数的功能是( )。A.将s2所指字符串赋给s1B.比较s1和s2所指字符串的大小,若s1比s2的大,函数值为1,否则函数值为0C.比较s1和s2所指字符串是否相等,若相等,函数值为1,否则函数值为0D.比较s1和s2所指字符串的长度,若s1比s2的长,函数值为1,否则函数值为0

考题 下列程序运行后,输出结果是______。 include include fun(char *w ,int 下列程序运行后,输出结果是______。 #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; p="1234567"; fun (p, strlen (p)); puts (p); }A.1234567B.7654321C.1711717D.7177171

考题 下面程序的运行结果是includeincludemain(){ char*s1="AbDeG";char*s2="Ab 下面程序的运行结果是 #include<stdio.h> #include<string.h> main() { char*s1="AbDeG"; char*s2="AbdEg"; s1+=2;s2+=2; printf("%d\n",strcmp(s1,s2)); }A.正数B.负数C.零D.不确定的值

考题 参照函数模板的写法,完成非模板函数的定义,语句为______。 include include 参照函数模板的写法,完成非模板函数的定义,语句为______。include<iostream.h>include<string.h>template<class T>T min(T a,T b){return(a<b? a:b);}char*rain(char*a,char*b){______}void main( ){double a=1.23,b=3.45;char s1[]="abed",s2[]="efg";cout<<min(a,b)<<min(s1,s2)<<endl;}

考题 以下程序的输出结果是_______。includeincludefun(char*w,int n){char t,*s 以下程序的输出结果是_______。 #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++: *sl=*s2-; *s2=t; } } main() { char*p; p="1234567"; fun(p,strlen(p)); puts(p); }A.1234567B.7654321C.1711717D.7177171

考题 已知函数定义如下,函数abed的功能是( )。 abcd(char *s1,char *s2) { while(*s2++=*s1++); }A.串复制B.求串长C.串比较D.串反向

考题 以下程序中函数scmp的功能是返回形参指针s1和s2所指字符串中较小字符串的首地址。 #include<string> char*scmp(char*s1,char*s2) { if(strcmp(s1,s2)<0) return(s1); else retrun(s2); } main() { int i;char string[20],str[3][20]; for(i=0;i<3;i+A.abcdB.abbaC.abcD.abca

考题 设下面程序段中调用fun函数传送实参a和b, main() { chara[10],b[10] ┇ fun(a,b); ┇ } 则在fun函数首部中,对形参错误的定义是( )A.fun(char a[10],b[10]){…}B.fun(char a1[],char a2[]){…}C.fun(char p[10],char q[10]){…}D.fun(char*s1,char*s2){…}

考题 有以下程序: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

考题 有以下程序:include using namespace std;int main ( ){ char s1[10],s2[10]; char*p 有以下程序: #include <iostream> using namespace std; int main ( ) { char s1[10],s2[10]; char *p=s1,*q=s2; cin>>s1>>s2; while (*p ! =' \0 ' ) p++; while (*q!='\0') *p++=*q++; *p='\0'; cout<<s1<<end1; return 0; }A.abcd0ghijB.abcd0ghij0C.abcdD.abcdghij

考题 下面程序的运行结果是______。 include include fun(char*w,int n) { char 下面程序的运行结果是______。 #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; p="1234567"; fun(p,strlen(p)); puts(p); }A.7654321B.1714171C.1711717D.7177171

考题 以下程序的输出结果是( )。 include main() {char*s1,*s2,m; s1=s2=(char*)malloc(size 以下程序的输出结果是( )。include<stdlib.h>main(){char*s1,*s2,m;s1=s2=(char*)malloc(sizeof(char));*s1=15;*s2=20;m=*s1+*s2:printf("%d\n",m);}

考题 下列程序的运行结果是()。      #include   #include   FUN(char *w,int n)  {   char temp,*s1,*s2; s1=w;  s2=w+n-1;  while(s1temp=*s1++;  *s1=*s2--;  *s2=temp;  }  }      main( )  {   char *p;  p=“1234567”;  FUN(p,strlen(p));  puts(p);  }

考题 有以下程序  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

考题 填空题下列程序的运行结果是()。      #include   #include   FUN(char *w,int n)  {   char temp,*s1,*s2; s1=w;  s2=w+n-1;  while(s1temp=*s1++;  *s1=*s2--;  *s2=temp;  }  }      main( )  {   char *p;  p=“1234567”;  FUN(p,strlen(p));  puts(p);  }

考题 单选题有以下程序  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