当前位置:网站首页>C语言:选择排序法
C语言:选择排序法
2022-07-24 04:25:00 【念迟鱼学编程】
#include <stdio.h>
int main()
{
int a[10] , i , j;
printf("请输入10个数:");
for(i = 0 ; i < 10 ; i++){
scanf("%d",&a[i]);
}
printf("\n===========排序前============\n");
for(i = 0 ; i < 10 ; i++){
printf("%5d",a[i]);
}
for(i = 0 ; i < 9 ; i++){
for(j = i+1 ; j < 10 ; j++){
if(a[i] > a[j]){
int t = a[i];
a[i] = a[j];
a[j] = t;
}
}
}
printf("\n===========排序后============\n");
for(i = 0 ; i < 10 ; i++){
printf("%5d",a[i]);
}
return 0;
}
边栏推荐
- What new opportunities exist in the short video local life section?
- Design and implementation of data analysis platform for intelligent commerce
- Game improvement of smart people: Chapter 3 Lesson 3: find game
- Send data 1010_ 1. The number of bytes passed by the sender
- How to change the direction of this gracefully
- Vscode configuration user code snippet
- Ros2 common command line tools organize ros2cli
- Iqoo 10 series attacks originos original system to enhance mobile phone experience
- Codeforces Round #808 (Div. 2) A - D
- C语言经典习题之评委打分去掉最高最低求平均分
猜你喜欢

Ambire gas tank launches exclusive NFT launch

ARP Spoofing protection of network security

Chapter III query processing of PostgreSQL Guide - Insider exploration

短视频本地生活版块,有哪些新的机会存在?

What new opportunities exist in the short video local life section?

Particle Designer:粒子效果制作器,生成plist文件并在工程中正常使用

Privacy protection federal learning framework supporting most irregular users

Can NFT pledge in addition to trading?

Leetcode 20 valid parentheses, 33 search rotation sort array, 88 merge two ordered arrays (nums1 length is m+n), 160 intersecting linked list, 54 spiral matrix, 415 character addition (cannot be direc

Post it notes --46{hbuildx connect to night God simulator}
随机推荐
Codeforces Round #809 (Div. 2) A - D1
64 attention mechanism 10 chapters
高频小信号谐振放大器设计-课程设计Multisim仿真
[09] program loading: "640K memory" is really not enough?
Collection of test case design methods
PostgreSQL guide -- inside exploration Chapter 1 database clusters, databases and data tables
Ambire wallet opens twitter spaces series
[JS] save the string as a file to the local (.Txt,.Json,.Md...)
Embedded system transplantation [6] - uboot source code structure
Post it notes --46{hbuildx connect to night God simulator}
mysql服务1主2从,主主,MHA配置详细步骤
How did I get four offers in a week?
Jinglianwen technology provides 3D point cloud image annotation service
Will your NFT disappear? Dfinity provides the best solution for NFT storage
From bio to realizing the function of simple multi person chat room -- IO model
00cm non, make sure to go online with the business party once in advance, and make everything better
Basic learning notes of C language
flask框架中页面跳转与重定向
阿里淘系面试题:Redis 如何实现库存扣减操作和防止被超卖?
.gz的业务交互和对外服篇中我们通合多个模型