#include#includevoidmain(){chara[20],b[20];strcpy(a,"apple");strcpy(b,a);strcpy(a,"OK");puts(a);}(5.0分)
OK
举一反三
- 写出程序运行结果:#include"stdio.h"#include"string.h"main(){charst1[15],st3[15],st2[]="CLanguage";strcpy(st1,st2);strcpy(st3,st2,3);puts(st1);puts(st3);printf("");}
- 如果在程序中需要用到strcpy、strcat等库函数时,需要用#include包含头文件。 A: math.h B: string.h C: ctype.h D: stdio.h
- 使用strcpy函数应该包含头文件____。 A: stdio.h B: conio.h C: string.h D: math.h
- #include “string.h”main(){ char p[20]={‘a’,’b’,’c’,’d’}; char q[ ]=“abc”,r[ ]=“abcde”; strcpy(p+strlen(q),r); strcat(p,q);puts(p);}程序的输出结果为 。
- char s[80], *sp = HELLO!”; sp = strcpy(s, sp); s[0] = ‘h’; puts(sp);
内容
- 0
29.有以下程序(strcpy为字符串复制函数,strcat为字符串连接函数) #include #include main() { char a[10]="abc",b[10]="012",c[10]="xyz"; strcpy(a+1,b+2); puts(strcat(a,c+1));} 程序运行后的输出结果是
- 1
使用库函数前包含头文件stdio。h的正确命令是( )。 A: @include<stdio.h> B: #include<stdio.h> C: #include stdio.h D: #include”stdio.h”
- 2
下段代码的运行结果是: intmain() { chara; char*str=&a; strcpy(str,"hello"); puts(str); return0; }
- 3
char s[80],*sp="HELLO!";sp=strcpy(s,sp);s[0]='h';puts(sp);运行结果:________
- 4
如果程序中用到标准库函数sqrt( )和strcmp( ),那么该程序应含下面哪两条语句( ) A: B: include “stdio.h” C: include “math.h” D: E: include “math.h” F: incluede “string.h” G: H: include “string.h” I: include “stdio.h” J: K: include “stdlib.h” L: include ”math.h”