#include<stdio.h>
#define ARR_SIZE 40
void Sort(float score[],long num[],int n);
int main()
{
float score[ARR_SIZE];
int n,i;
long num[ARR_SIZE];
printf("please enter total number:");
scanf("%d",&n);
printf("please enter the number and score:\n");
for(i=0;i<n;i++)
{
scanf("%ld%f",&num[i],&score[i]);
}
Sort(score,num,n);
printf("Sorted results:\n");
for(i=0;i<n;i++)
{
printf("%ld\t%4.0f\n",num[i],score[i]);
}
}
void Sort(float score[],long num[],int n)
{
int i,j;
float temp1;
long temp2;
for(i=0;i<n-1;i++)
{
for(j=i+1;j<n;j++)
{
if(score[j]>score[i])
{
temp1=score[j];
score[j]=score[i];
score[i]=temp1;
//交换学号
temp2=num[j];
num[j]=num[i];
num[i]=temp2;
}
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
C语言基础40道编程题目编程代码汇总
共80个文件
cpp:40个
exe:40个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 4 浏览量
2022-05-23
16:15:43
上传
评论 1
收藏 1.62MB ZIP 举报
温馨提示
文章链接:http://t.csdn.cn/iwqS8 40道代码都可以运行,方便学习
资源推荐
资源详情
资源评论
收起资源包目录
40道编程题代码.zip (80个子文件)
题16.cpp 236B
题3.cpp 147B
题34.cpp 790B
题13.cpp 606B
题18.exe 128KB
题16.exe 128KB
题24.exe 129KB
题15.cpp 132B
题33.cpp 513B
题10.cpp 275B
题4.cpp 280B
题31.cpp 468B
题39.cpp 402B
题30.cpp 238B
题12.exe 128KB
题8.exe 129KB
题19.cpp 203B
题14.exe 128KB
题20.cpp 274B
题30.exe 128KB
题25.cpp 328B
题17.exe 128KB
题22.cpp 194B
题32.cpp 347B
题34.exe 130KB
题32.exe 128KB
题27.cpp 426B
题29.exe 129KB
题35.cpp 580B
题15.exe 128KB
题20.exe 128KB
题1.exe 128KB
题10.exe 129KB
题36.exe 129KB
题17.cpp 143B
题5.cpp 185B
题40.cpp 400B
题35.exe 129KB
题28.exe 128KB
题26.cpp 363B
题11.cpp 563B
题9.cpp 248B
题8.cpp 243B
题40.exe 133KB
题2.exe 129KB
题33.exe 129KB
题11.exe 129KB
题18.cpp 197B
题38.cpp 489B
题6.cpp 260B
题24.cpp 779B
题13.exe 129KB
题39.exe 129KB
题9.exe 128KB
题21.cpp 249B
题7.exe 129KB
题19.exe 128KB
题37.exe 129KB
题5.exe 128KB
题4.exe 128KB
题3.exe 128KB
题28.cpp 406B
题23.cpp 399B
题38.exe 129KB
题37.cpp 339B
题7.cpp 363B
题22.exe 128KB
题6.exe 129KB
题31.exe 129KB
题12.cpp 324B
题21.exe 128KB
题36.cpp 538B
题29.cpp 320B
题2.cpp 277B
题23.exe 128KB
题1.cpp 156B
题26.exe 129KB
题27.exe 129KB
题25.exe 129KB
题14.cpp 315B
共 80 条
- 1
资源评论
是筱倩阿
- 粉丝: 1655
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功