解题思路:用sort函数进行排列(默认从小到大)
注意事项:需要用到头文件#include <algorithm>和using namespace std;
参考代码:
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
int a[4];
for(int i=0;i<4;i++)
scanf("%d",&a[i]);
sort(a,a+4);
for(int i=0;i<4;i++)
printf("%d ",a[i]);
return 0;
}
0.0分
0 人评分
P1002 (C语言代码)浏览:976 |
回文串 (C语言代码)浏览:2856 |
字符串对比 (C语言代码)浏览:1403 |
A+B for Input-Output Practice (II) (C语言代码)浏览:998 |
C语言程序设计教程(第三版)课后习题11.8 (C语言代码)浏览:878 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:619 |
DNA (C语言描述,蓝桥杯)浏览:1553 |
1134题解(求分析)浏览:727 |
【计算球体积】 (C语言代码)浏览:1550 |
字符删除 (C语言代码)浏览:720 |