📄 姓名排序.cpp
字号:
#include<stdio.h>
#include<string.h>
void main()
{
int n;
int rod,ser;
char name[10][12];
char temp[10];
for(n=0;n<7;n++)
{
printf("Enter the name of the people %d: ",n+1);
scanf("%s",name[n]);
}
for(rod=0;rod<7;rod++)
{
for(ser=rod+1;ser<7;ser++)
{
if(strcmp(name[rod],name[ser])>0)
{
strcpy(temp,name[rod]);
strcpy(name[rod],name[ser]);
strcpy(name[ser],temp);
}
}
}
printf("\nthe order of the names is:\n");
for(n=0;n<7;n++)
printf("the name of the people %d is: %s\n",n+1,name[n]);
printf("\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -