char name[4][22]={"yez","zhaoguodong","yangp,"};
char n[22]={0};
for (int i=0; i<3; i++) {
for (int y=0; y<3-i; y++) {
if (strcmp(name[y], name[y+1])>0) {
strcpy(n, name[y]);
strcpy(name[y], name[y+1]);
strcpy(name[y+1], n);
}
}
}
for (int i=0; i<4; i++) {
printf("%s\n",name[i]);
}
//冒泡排序 a[]数组 地址,n是元素个数
/*
//函数的第一种形式
void sumNum(){
int a=10,b=20,sum=a+b;
printf("%d\n",sum);
printf("此算数版权归我所有");
}
void hello(void){ //无参数无返回值
printf("hello,lanou");
}
int peopleCount(void){ //无参数有返回值
return 33;
}
int max(int a,int b){ //有参数有返回值
return a>b?a:b;
}
void printNumber(int x){ //有参数,无返回值
printf("number is %d",x);
}
int sum(int a,int b){
return a+b;
}
void change(int a,int b){
int temp=0;
temp=a;
a=b;
b=temp;
}
int sunValue(int n){
int sum=0;
for (int i=0; i<=n; i++) {
sum+=i;
}
return sum;
}
int dayOfYear(int year,int mouth,int day){
int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int sum=0,m=0;
if ((year%400==0)||((year%4==0)&&year%100!=0)) {
month[1]=29;
for (int i=0; i<mouth; i++) {
sum+=month[i];
}
m=sum-month[mouth-1]+day;
}
else {
for (int i=0; i<mouth; i++) {
sum+=month[i];
}
m=sum-month[mouth-1]+day;
}
return m;
}
*/
//函数调用
/*
peopleCount();
hello();
int num_1=10,num_2=20;
change(num_1,num_2);
printf("%d,%d",num_1,num_2);
int ss=0;
ss=sunValue(5);
printf("\n%d",ss);
int ee=0;
ee=dayOfYear(2000, 3, 1);
printf("\n%d",ee);
*/