- 1
- 0
- 约2.28万字
- 约 35页
- 2017-12-22 发布于河南
- 举报
计算机等级考试(三级)上级资料
计算机等级考试(三级)上级资料
按结构体成员筛选并排序
void SortDat()
{ int i,j; /* 定义变量 */
PRO temp;
for(i=0;iMAX-1;i++) /* 选择法排序 */
for(j=i+1;jMAX;j++)
if(strcmp(sell[i].mc,sell[j].mc)0 /* 判断条件 */
||strcmp(sell[i].mc,sell[j].mc)==0sell[i].jesell[j].je)
{ temp=sell[i];
sell[i]=sell[j];
sell[j]=temp;
}
}
数位分解后按数筛选统计并排序
void jsValue()
{ int i,j; /* 定义变量 */
int a1,a2,a3,a4;
int temp;
for(i=0;i300;i++)
{ a1=a[i]%10; /* 数位分解 */
a2=a[i]%100/10;
a3=a[i]%1000/100;
a4=a[i]/1000;
if(a4+a1==a3+a2) /* 判断条件 */
b[cnt++]=a[i];
}
for(i=0;icnt-1;i++) /* 选择法排序 */
for(j=i+1;jcnt;j++)
if(b[i]b[j])
{ temp=b[i];
b[i]=b[j];
b[j]=temp;
}
}
void jsVal()
{ int i,j; /* 定义变量 */
int a1,a2,a3,a4;
int temp;
for(i=0;iMAX;i++)
{ a1=a[i]%10; /* 数位分解 */
a2=a[i]%100/10;
a3=a[i]%1000/100;
a4=a[i]/1000;
if(a1%2==1a2%2==1a3%2==1a4%2==1) /* 判断条件 */
b[cnt++]=a[i];
}
for(i=0;icnt-1;i++) /* 选择法排序 */
for(j=i+1;jcnt;j++)
if(b[i]b[j])
{ temp=b[i];
b[i]=b[j];
b[j]=temp;
}
}
void jsVal()
{ int i,j; /* 定义变量 */
int temp;
for(i=0;iMAX;i++)
if(a[i]%2==1b[i]%2==0||a[i]%2==0b[i]%2==1) /* 判断条件 */
c[cnt++]=(a[i]8)+b[i];
for(i=0;icnt-1;i++) /* 选择法排序 */
for(j=i+1;jcnt;j++)
if(c[i]c[j])
{ temp=c[i];
c[i]=c[j];
c[j]=temp;
}
}
void countValue()
{ int i,j; /* 定义变量 */
int a1,a2,a3,a4;
for(i=1000;i=9999;i++)
{ a1=i%10; /* 数位分解 */
a2=i%100/10
您可能关注的文档
最近下载
- 部编版语文五年级下册第二单元教材解读大单元集体备课.pptx VIP
- 部编版语文五年级下册第一单元教材解读大单元集体备课.pptx VIP
- 车工 (数控车床)理论知识考核要素细目表四级.pdf VIP
- 本科课程《基础护理学》教案,第十二章给药.doc VIP
- 农村题材小品剧本村官.pdf VIP
- 小品剧本-小品《绰号》.docx VIP
- 小品剧本-小品《竞选》.docx VIP
- 本科课程基础护理学教给药教案(2025—2026学年).docx VIP
- LaserjetCP1025系列打印机打印质量故障排除手册.pdf VIP
- 年会小品剧本小品剧本:搞笑小品剧本《都是喝酒惹事》台词大全.docx VIP
原创力文档

文档评论(0)