单选题设有以下语句: char str1[]= “string”,str2[8],*str3,*str4= “ string”; 则不能对库函数strcpy(复制字符串)的正确调用的是()Astrepy(str1,“HELLO1”);Bstrepy(str2,“HELL02”);Cstrcpy(str3, “HELL03”)Dstrcpy(str4, “HELLO4”);
单选题
设有以下语句: char str1[]= “string”,str2[8],*str3,*str4= “ string”; 则不能对库函数strcpy(复制字符串)的正确调用的是()
A
strepy(str1,“HELLO1”);
B
strepy(str2,“HELL02”);
C
strcpy(str3, “HELL03”)
D
strcpy(str4, “HELLO4”);
参考解析
解析:
暂无解析
相关考题:
请编写一个函数int compare(char *s,char *t)), 该函数的功能是对两个字符串进行比较。当s所指字符串和t所指字符串相等时,返回值为0;当s所指字符串大于是t指字符串时,返回值大于0;当s所指字符串小于t所指字符串时,返回值小于0。注意:部分源程序已存在文件PROC8.cpp中。文件PROC8.cpp的内容如下://PROC8.cppinclude <iostream>include <string>using namespace std;int compare(char *s,char *t){//* * * * * * * * *}int main (){char str1[100],str2[100];int result;cout<<"Input the first string\n";cin>>str1;cout<<"Input the second string\n";cin>>str2;result=compare(str1,str2);if (result==0)cout<<"string1=string2 ! \n";else if (result>0)cout<<"string1>string2 ! \n";elsecout<<"string1<string2 ! \n";return 0;}
字符串"\\\"ABCDEn"\"\\"的长度是( )。A.strcpy(str2,str1)B.strcpy(str3,str1)C.strcpy(str4,str1)D.strcpy(str5,str1)
设有语句:char str1[]="string",str2[8],*str3,*str4="string";,则下列对库函数strcpy调用不正确的是A.strcpy(str1,"Hello1");B.strcpy(str2,"Hello2");C.strcpy(str3,"Hello3");D.strcpy(str4,"Hell04");
设有以下语句: char str1[]="string",str2[8],*str3,*str4=="string; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4")
下面程序执行后,输出结果为:true请在程序的每条横线处填写一个语句,使程序的功能完整。注意:请勿改动main()主方法和其他已有的语句内容,仅在横线处填入适当的语句。public class TestStringCompare{{public static void main(String ____________________ args){char charl[]={'t','e','s','t'};char char2[]={'t','e','s','t','1'};String str1=new String(___________________);String str2=new String(char2,0,4);System.out.println(__________________________);}}
请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2接在字符串str1的后面。例如:str1=“How do”,str2=“you do?”,结果输出: How do you do?注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define N 40void fun(char*str1,char *str2){int i=0;char *pl=str1;char*p2=str2;while(【 】)i++;for(;【 】;i++)*(p1+i)=【 】;*(p1+i)='\0';}main(){char str1[N],str2[N);clrscr();printf("*****Input the string str1 Str2*****\n");printf("\nstr1:");gets(str1);printf("\nstr2:");gets(str2);printf("**The string str1 str2**\n");puts(str1);puts(str2);fun(str1,str2);printf("*****The new string *****\n");puts(str1);}
设有以下语句: char str1 []="string"mstr2 [8],*str3,*str4=="string"; 则 ______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str 4,"HELLO4");
设有以下语句: char str 1[]="string",str2[8],*str3,*str4="string"; 则______不是对库函数的正确调用。A.strcpy(str 1,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4");
下面代码的运行结果是( )。 public class ConcatTest { public static void main (String[ ] args) { String str1 = "abc"; String str2 = "ABC"; String str3 = str1. coneat(str2); System. out. println(str3); } }A.abcB.ABCC.abcABCD.ABCabc
以下选项中,合法的是( )。A.char str3[]={d,e,b,u,g,\0};B.char str4;str4="hello world";C.char name[10];name="china";D.char strl[5]="pass",str2[6];str2=strl;
设有以下语句: char strl[]="string",str2[8],*str3,*str4="string"; 则_______不是对库函数的正确调用。A.strcpy(strl,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4");
阅读下面程序 public class ConcatTest{ public static void main(String[] args) { String strl = "abc"; String str2 = "ABC"; String str3 = str1.concat(str2); System.out.println(str3); } } 程序的运行结果是:A.abeB.ABCC.abcABCD.ABCabc
设有以下语句: char strl[]="string",str2[8],*str,*str4="string"; 则______不是对库函数的正确调用。A.strcpy(strl,"HELLO1");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLO3");D.strcpy(str4,"HELLO4");
下面是一个Applet程序,其功能是捕捉用户所按下的键,并将捕捉到的键时间,传给程序,程序再将所按下的字符显示在Applet中。请改正程序中的错误(有下划线的语句),使程序能输出正确的结果。注意:不改动程序的结构,不得增行或删行。程序运行结果如下:import java.awt.*;import java.applet.*;/*<applet code="ex15_3.class,, width=800 height=400 ></applet>*/public class ex15_3 extends JApplet{private String str1;private String str2;private String str3;public void init(){str1 = "Character:";str2 = "Number: ";str3 = "Key State:";}public void paint(Graphics g){g.drawString(str1, 20, 30);g.drawString(str2, 20, 50);g.drawString(str3, 20, 70);}public boolean keyUp(Event e, int n){str1 = "Character:" + String.valueOf(n);str2 = "Number:" + n;str3 = "Key State:Key Up";repaint();return true;}public boolean keyDown(Event e, int n){str1 = "Character:" + String.valueOf(n);str2 = "Number:" + n;str3 = "Key State:Key Down";repaint();return true;}}ex15_3.html<HTML><HEAD><TITLE>ex15_3</TITLE></HEAD><BODY><applet code="ex15 3.class" width=800 height=400 ></applet></BODY></HTML>
设有语句:char str1[]="string", str2[8], *ste3, *str4="string";,则下列不是对库函数 strcpy的正确调用的是______。A.strcpy(str1,"HELLOI");B.strcpy(str2,"HELLO2");C.strcpy(str3,"HELLOY");D.strcpy(str4,"HELLO4");
以下三条输出语句分别输出什么?char str1[] = "abc";char str2[] = "abc";const char str3[] = "abc";const char str4[] = "abc";const char* str5 = "abc";const char* str6 = "abc";cout boolalpha ( str1==str2 ) endl; // 输出什么?cout boolalpha ( str3==str4 ) endl; // 输出什么?cout boolalpha ( str5==str6 ) endl; // 输出什么?
执行下面的程序,单击窗体后在窗体上显示的结果是 ______。Private Sub form_ Click() Dim Str1 As String, Str2 As String Dim Str3 As String, I As Integer Str1 = "e" for I = t To 2 Str2 = Ucase (Str1) Str1 = Str2 Str1 Str3 = Str3 Str1 str1 = Chr (Asc(Str1) + I) Next I Print Str3End SubA.EeFFB.eEfFC.EEFFD.eeFF
请补充函数fun(),该函数的功能是:把从主函数中输入的字符串str2倒置后接在字符串str1后面。例如:str1=“How do”,str2=“?od uoy”,结果输出:“How do you do?”。注意:部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun()的横线上填入所编写的若干表达式或语句。试题程序:include<stdio.h>include<conio.h>define N 40void fun(char *str1,char *str2){int i=0,j=0,k=0,n;char ch;char *p1=str1;char *p2=str2;while(*(p1+i))i++;while(*(p2+j))j++;n=【 】;for(;k=j/2;k++,j--){ch=*(p2+k);*(p2+k)=*(p2+j);*(p2+j)=ch;}【 】;for(;【 】;i++)*(p1+i)=*p2++;*(p1+i)='\0';}main(){char str1[N],str2[N];int m,n,k;clrscr();printf("***Input the string str1 str2***\n");printf("\nstr1:");gets(str1);printf("\nstr2:");gets(str2);printf("***The string str1 str2 ***\n");puts(str1);puts(str2);fun(str1,str2);printf("*** The new string ***\n");puts (str1);}
库函数strcpy用以复制字符串,若有以下定义和语句: char str1[]="china",str2[10],*str3,*str4="china"; 则对库函数strcpy的正确的调用是_______。A.strcpy(strl,"people");B.strcpy(str2,"people");C.strcpy(str3,"people");D.strcpy(str4,"people");
若有下列说明,则( )不是对strcpy库函数的正确的调用。strcpy库函数用于复制一个字符串:char*str1="abcdt",str2 [10],*str3="hijklmn",*str4[2],*str5="aaaa";A.strcpy(str2,str1)B.strcpy(str3,str1)C.strcpy(str4,str1)D.strcpy(str5,str1)
执行以下语句后,str2的值是( )。 String str1="abc"; String str2=strconcat("cde");A.abcdeB.abccdeC.cdeabcD.edccba
设有以下语句: char str1[]="string",str2[8],*str3,*str4="str4="string"; 则______不是对库函数的正确调用。A.strcpy(str1,"HELLO1");B.strcpy(str2."HELLO2");C.strcpy(str3."HELLO3");D.strcpy(str4."HELLO4");
设有以下语句: char str1[]= “string”,str2[8],*str3,*str4= “ string”; 则不能对库函数strcpy(复制字符串)的正确调用的是()A、strepy(str1,“HELLO1”);B、strepy(str2,“HELL02”);C、strcpy(str3, “HELL03”)D、strcpy(str4, “HELLO4”);
假如有字符串str1和字符串str2,下列选项不能利用于比较这两个字符串是否相等的是()。A、string.Compare(str1,str2)B、str1= =str2C、string.Equals(str1,str2)D、string.CompareTo(str1,str2)
单选题以下选项中,合法的是( )。Achar str3[]={'d', 'e', 'b', 'u', 'g', '\0'}Bchar str4; str4=hello world;Cchar name[10]; name=china;Dchar str1[5]=pass, str2[6]; str2=str1;
单选题若有定义语句:char str1[] = "string", str2[8], *str3, str4[10] = "string";库函数strcpy的功能是复制字符串,以下选项中错误的函数调用是( )。Astrcpy(str3, "HELLO!");Bstrcpy(str2, "HELLO!");Cstrcpy(str1, "HELLO!");Dstrcpy(str4, "HELLO!");