📄 sa3108.c
字号:
#include <string.h>
#include <stdio.h>
main()
{
char name1[12],name2[12],mixed[25];
char title[20];
strcpy(name1,"Rosalinda"); /*拷贝字符串*/
strcpy(name2,"Zeke");
strcpy(title,"This is the title.");
printf(" %s\n\n",title);
printf("Name 1 is %s\n",name1);
printf("Name 2 is %s\n",name2);
/*选择语句*/
if(strcmp(name1,name2)>0) /* 比较字符串如果 name1 > name2则返回正数 */
strcpy(mixed,name1); /*将字符串name1 拷贝到字符数组mixed*/
else
strcpy(mixed,name2);
printf("The biggest name alpabetically is %s\n",mixed);
strcpy(mixed,name1);
strcat(mixed," ");/*将空格接到mixed后面,mixed后的空格取消*/
strcat(mixed,name2);/*将name2接到 mixed后面*/
printf("Both names are %s\n",mixed);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -